Functions

You can benefit various functions when designing your app on Kuika Designer. You can make use of a bunch of predefined functions or you can add a new function of your own. Functions make it easy to call and run units of work repeatedly in your app design.

You can add new functions for your domain through Kuika Management portal, or you can use built in functions of Kuika domain in all your domains.

Basic Type Functions

String Functions

Syntax

STRLENGTH(word)

Definition

Returns length of the string word.

Return type: Integer.

Parameters
word Type: String. Required.
Example
word Formula Result
“Kuika” LENGTH(word) 5
“Software” LENGTH(“Software”) 8

Syntax

LIKE(word, pattern)

Definition

Checks if word contains a substring matching with pattern. Returns true or false.

Parameters
word Type: String. Required. Base string to match the pattern.
pattern Type: String. Required. Substring to be matched against in word.
Example
word pattern Formula Result
“Low Code” “Co” LIKE(word, pattern) true
“Low Code” “Coder” LIKE(word, pattern) false
Syntax

FIND(substring, string, starting_index)

Definition

Returns true if substring exists in string within indices starting from starting_index to the end of the word string. If starting index is not specified, ust checks within the whole string.

Return Type: Boolean

Parameters
substring Type: String. Required. String to be searched.
string Type: String. Required. String to perform the search operation inside.
starting_index Type: Integer. Optional. The index number that specifies the position to start searching in the string.
Example
substring string starting_index Formula Result
“windo” New window FIND(substring,string) true
“windo” New window 2 FIND(substring,string,starting_index) true
“windo” New window 5 FIND(substring,string,starting_index) false

Syntax

LOWER(word)

Definition

Returns a new string as the lower-cased version of string word.

Return Type: String

Parameters
word Type: String. Required. String to be made lower-case..
Example
word Formula Result
“Innovation” LOWER(“Innovation”) “innovation”
Syntax

SUBSTITUTE(string, substring, new_substring)

Definition

Creates and returns a new string that is created by replacing a substring in a string by new_substring.

Return Type: String

Parameters
string Type: String. Required. The whole string.
substring Type: String. Required. The string to be replaced.
new_substring Type: String. Required. The string that replaces substring.
Example
string substring new_substring Formula Result
“Innovation” “on” “ve” SUBSTITUTE(string, substring, new_substring) “Innovative”
“All that we see or seem is but a dream within a dream.” “see or seem” “know” SUBSTITUTE(string, substring, new_substring) “All that we know is but a dream within a dream.”

Syntax

REPLACE(string, from_index, to_index, new_substring)

Definition

Creates and returns a new string that is created by replacing a substring between indices from_index and to_index, in a string by new_substring.

Return Type: String

Parameters
string Type: String. Required. The whole string.
from_index Type: Integer. Required. Starting index to replace.
to_index Type: Integer. Required. Ending index to replace.
new_substring Type: String. Required. The string that replaces substring between indices from_index and to_index.
Example
string from_index to_index new_substring Formula Result
“Michelangelo’s David” 0 11 “Bernini” REPLACE(string, 0,11,, new_substring) “Bernini’s David”
Syntax

CONCATENATE(firstword, secondword)

Definition

Concatenates two strings firstword and secondword, then returns it as a new string.

Return Type: String

Parameters
firstword Type: String. Required.
secondword Type: String. Required.
Example
firstword secondword Formula Result
“Welcome to ” “Kuika!” CONCATENATE(firstword,secondword) “Welcome to Kuika!”

Syntax

CHAR(number)

Definition

Converts an integer number into a text and returns it.

Return Type: String

Parameters
number Type: Integer. Required.
Example
number Formula Result
123456 CHAR(123456) “123456”
Syntax

NEWGUID()

Definition

Generates and returns a new Guid.

Return Type: Guid

Example
Formula Result
NEWGUID() 054992f1-452a-4281-87d3-48d93fc35617

Syntax

TOSTRING(object)

Definition

Converts any type of object into String format and then returns that new string.

Return Type: String

Parameters
object Required.
Example
object Formula Result
123456 TOSTRING(123456) “123456”

Syntax

CLEAN(text)

Definition

Strips non-printable ASCII characters in the text, and returns text after modification.

Return Type: String

Parameters
text Type: String. Required. The string modified to be free from non-printable ASCII characters.
Example
text Formula Result
“NULL.hel+SHlo!” (Suppose NULL and SH refer to NULL character, and Shift character, respectively, which are non-printable ASCII characters.) CLEAN(text) “.hel+lo!”

Date Functions

Syntax

TODAY()

Definition

Returns the current date and time information.

Return Type: DateTimeOffset

Example
Formula Result
TODAY() Wednesday, August 2, 2017 04.25 PM
Syntax

DATETOSTRING(date)

Definition

Returns date object formatted as text.

Return Type: String

Parameters
date Type: DateTimeOffset. Required.
Example
date Formula Result
Wednesday, August 2, 2017 04.37 PM DATETOSTRING(date) “Wednesday, August 2, 2017 04.37 PM”

Syntax

ADDMINUTES(date, minutes)

Definition

Adds minutes to date and returns a new DateTimeOffset object.

Return Type: DateTimeOffset

Parameters
date Type: DateTimeOffset. Required.
minutes Type: Integer. Required.
Example
date minutes Formula Result
Wednesday, August 2, 2017 04.37 PM 128 ADDMINUTES(date,minutes) “Wednesday, August 2, 2017 06.45 PM”
Syntax

DATEDIFFERENCEINDAYS(firstdate, seconddate)

Definition

Takes difference of two date objects and returns as number of days. If result is not an Integer, rounds it up.

Return Type: Integer

Parameters
firstdate Type: DateTimeOffset. Required.
seconddate Type: DateTimeOffset. Required.
Example
firstdate seconddate Formula Result
Wednesday, August 2, 2017 04.37 PM Wednesday, August 9, 2017 02.00 PM DATEDIFFERENCEINDAYS(firstdate, seconddate) 7

Boolean Functions

Syntax

IF(statement, then, else)

Definition

Checks statement. If statement passes, operation then is executed, otherwise, operation else is executed.

Returns resulting value after execution of operation then or else.

Parameters
statement Type: Boolean. Required.
then Required. The value to be assigned if statement passes.
else Required. The value to be assigned if statement fails.
Example
statement then else Formula x Result
x < 1000 y = 0 y = x * 2 IF(x < 1000, 0, x*2) 1200 2400
x == true y = “blue” y = “red” IF(x, “blue”, “red”) true “blue”

Syntax

ISNULL(object)

Definition

Checks if object is null. If so, returns true; otherwise, returns false.

Parameters
object Required. Data to be checked if null or not.
Example
object Formula x Result
x ISNULL(x) 2017 false
x ISNULL(x.FIRST()) [] true
Syntax

ISNOTNULL(object)

Definition

Checks if object is bound to any data. If so, returns true; otherwise, returns false.

Parameters
object Required. Data to be checked if null or not.
Example
object Formula x Result
x ISNOTNULL(x) 2017 true
x ISNOTNULL(x.FIRST()) [] false

Syntax

NOT(statement)

Definition

Checks if statement resolves to false. If so, returns true; otherwise, returns false.

Parameters
statement Required. Data to be checked if true or not.
Example
statement Formula x Result
x.FIRST() > 1 NOT(x.FIRST() > 1) [1,2,3] true
LENGTH(x) == 3 NOT(LENGTH(x) == 3) [1,2,3] false
Syntax

EXACT(firstword, secondword)

Definition

Checks if the strings firstword and secondword are the same. If so, returns true. Otherwise, returns false.

Return Type: Boolean

Parameters
firstword Type: String. Required.
secondword Type: String. Required.
Example
firstword secondword Formula Result
“Welcome” “Welcome” EXACT(firstword,secondword) true
“Welcome” “welcome!” EXACT(firstword,secondword) false
Syntax

IN(item, list)

Definition

Checks if item is contained in list. Returns true or false.

Parameters
item Required. Element to be searched.
list List to be searched in.
Example
item list Formula Result
Employee E Employees: [E,F,G] IN(E, Employees) true
Employee A Employees: [E,F,G] IN(A, Employees) false

List Functions

Syntax

datalist.FILTER(statement)

Definition

Filters the dataset datalist with respect to statement. No return value.

Parameters
datalist Required. Dataset to be filtered.
statement Type: Boolean. Required. Boolean expression to use for filtering.
Example
datalist statement Formula Result
[24,3,17,35] this > 20 datalist.FILTER(statement) [24,35]
[24,3,17,35] this > 20 and this < 30 datalist.FILTER(this > 20).FILTER(this < 30) [24]
Syntax

datalist.FIRST()

Definition

Returns the first element of a list.

Parameters
datalist Required.
Example
datalist Formula Result
[24,3,17,35] datalist.FIRST() [24]
[24,3,17,35] datalist.FILTER(this <  20).FIRST() [3]
Syntax

datalist.SORT(field, [statement])

Definition

Sorts datalist with respect to field, by using boolean expression statement.

Statement is an optional parameter.

On default, sorts in descending order.

Sorts in descending order if statement is true.

Sorts in ascending order if statement is false.

No return value.

Parameters
datalist Required. Dataset to be sorted.
field Required.datalist is sorted with respect to field.
statement Type: Boolean. Optional. If true, sorts in descending order; otherwise sorts in ascending order. 
Example
datalist Formula Result
[24,3,17,35] datalist.SORT(this) [35,24,17,3]
[24,3,17,35] datalist.SORT(this, true) [35,24,17,3]
[24,3,17,35] datalist.SORT(this, false) [3,17,24,35]
Syntax

TOSTRINGARRAY(datalist)

Definition

Converts elements of the list datalist to string, then returns a new list consisting of those strings.

Return Type: List of Strings

Parameters
datalist Type: List. Required.
Example
datalist Formula Result
[1,2,3,4] TOSTRINGARRAY(datalist) [“1”,”2”,”3”,”4”]

Syntax

datalist.TAKE(count)

Definition

Takes first “count” elements of datalist.

No return value.

Parameters
datalist Required. Dataset to be operated on.
count Required. Number of elements to take.
Example
datalist count Formula Result
[24,3,17,35] 1 datalist.TAKE(1) [24]
[24,3,17,35] 3 datalist.TAKE(3) [24,3,17]
Syntax

datalist.OFFSET(skipcount)

Definition

Skips the first “skipcount” elements of datalist, and then takes the remaining.

No return value.

Parameters
datalist Required. Dataset to be operated on.
skipcount Required. Number of elements to skip.
Example
datalist skipcount Formula Result
[24,3,17,35] 2 datalist.OFFSET(2) [17,35]
[24,3,17,35] 4 datalist.OFFSET(4) []
[24,3,17,35] 1 datalist.OFFSET(1).TAKE(2) [3,17]

Syntax

LENGTH(datalist)

Definition

Returns number of elements of the list datalist.

Parameters
datalist Required. Dataset to be operated on.
Example
datalist Formula Result
[24,3,17,35] LENGTH(datalist) 4
[] LENGTH(datalist) 0
Syntax

 ADDRANGE(firstlist, secondlist)

Definition

 Modifies firstlist to be the concatenation of firstlist and secondlist.

Parameters
firstlist  Required. The list to be modified.
secondlist  Required. The list to be added.
Example
firstlist secondlist Formula Result
 [“foo”, “bar”]  [“qux”, “foo”]  ADDRANGE(firstlist,secondlist) [“foo”, “bar”,”qux”, “foo”]
Syntax

CONCAT(firstlist, secondlist)

Definition

Returns a new list which is concatenation of firstlist and secondlist.

Return Type: List.

Parameters
firstlist Required.
secondlist Required.
Example
firstlist secondlist Formula Result
[“foo”, “bar”] [“qux”, “foo”] CONCAT(firstlist, secondlist) [“foo”, “bar”, “qux”, “foo”]
Syntax

DISTINCT(datalist)

Definition

Returns a new list consisting of distinct elements from datalist.

Return Type: List

Parameters
datalist Required.
Example
datalist Formula Result
[“foo”, “bar”, “foo”, “qux”, “qux”] DISTINCT(firstlist) [“foo”, “bar”, “qux”]
Syntax

CONTAINS(datalist, element)

Definition

Checks if datalist contains element. If so, returns true, otherwise, returns false.

Return Type: Boolean

Parameters
datalist Required. The list.
element Required. The element to be searched in datalist.
Example
datalist element Formula Result
[“foo”, “bar”, “foo”, “qux”] “bar” CONTAINS(datalist,”bar”) true
[“1”, “2”, “3”, “foo”] 1 CONTAINS(datalist,1) false
Syntax

COUNT(datalist)

Definition

Returns the number of elements contained in the list datalist.

Return Type: Integer

Parameters
datalist Required.
Example
datalist Formula Result
[“foo”, “bar”, “foo”, “qux”, “qux”] COUNT(firstlist) 5

Syntax

PUSH(datalist, element)

Definition

Adds element to the end of datalist.

Parameters
datalist Required. The list.
element Required. The element to be added to datalist.
Example
datalist element Formula Result
[“foo”, “bar”] “qux” PUSH(datalist,”qux”) [“foo”,“bar”,“qux”]

Syntax

UNION(firstlist, secondlist)

Definition

Returns a new list that is formed by merging firstlist and secondlist.

Parameters
firstlist Required. First list to be merged.
secondlist Required. Second list to be merged.
Example
firstlist secondlist Formula Result
[“foo”, “bar”, “baz”] [“qux”, “foo”] UNION(firstlist, secondlist) [“foo”, “bar”, “baz”, “qux”]

Syntax

INTERSECT(firstlist, secondlist)

Definition

Returns a new list that is formed by taking intersection of firstlist and secondlist.

Parameters
firstlist Required. First list to get intersect over.
secondlist Required. Second list to get intersect over.
Example
firstlist secondlist Formula Result
[“foo”, “bar”, “baz”] [“qux”, “foo”] INTERSECT(firstlist, secondlist) [“foo”]
Syntax

EXCEPT(firstlist, secondlist)

Definition

Returns a new list which consists of those elements that are in firstlist but not in secondlist.

Parameters
firstlist Required. Minuend of the difference operation.
secondlist Required. Subtrahend of the difference operation.
Example
firstlist secondlist Formula Result
[“foo”, “bar”, “baz”, “bar”] [“qux”, “foo”] EXCEPT(firstlist, secondlist) [“bar”, “baz”, “bar”]

Syntax

MEAN(list)

Definition

Returns the average  of a list consisting of decimals.

Return Type: Decimal

Parameters
list Type: List<Decimal>. Required.
Example
list Formula Result
[5.5,10.5,8.2,6.8]] MEAN(list) 7.75

Domain Entity Functions

Syntax

UISelect(initialselection, selectby, options)

Definition

Selects from among options, displayed as selectby list. It is initialized with initialselection.

Returns the selected item.

Parameters
initialselection Optional. Initially selected object x.
selectby Required. Displayed field in options list
options Required. Data to be listed.
Example
initialselection selectby options Formula Result
Email Employees [E,F,G] UISelect(Emloyee E, String Email, Employees) Employee F
Syntax

UIInput(input)

Definition

Creates a new record input. Returns input.

Parameters
input Type: Generic. Required. Data to be saved.
Example
Formula Result
UIInput(Employee E) Employee E
Syntax

UIEdit(editvar)

Definition

Edits editvar, returns editvar.

Parameters
editvar Required. Data to edit.
Example
Formula Result
UIEdit(Employee E) Employee E
Syntax

UIDisplay(displayvar)

Definition

Displays displayvar.

No return value.

Parameters
displayvar Required. Data to display.
Example
Formula Result
UIDisplay(Employee E) Employee E
Syntax

ROUTETO(userid)

Definition

Returns RoutingId for userid. RoutingId is then used to route the related workflow step to the user having userid.

Parameters
userid Type: Guid. Required.
Example
userid Formula Result
7682fd1f-629d-4d7f-a2f1-61e7553db94d ROUTETO(userid) 00aafc7c-506d-4872-b31e-3421ef85fd78
Syntax

ROUTETOLOGINNAME(loginname)

Definition

Returns RoutingId for loginname. RoutingId is then used to route the related workflow step to the user having loginname.

Parameters
loginname Type: String. Required.
Example
loginname Formula Result
“jane.doe@kuika.com” ROUTETOLOGINNAME(loginname) 00aafc7c-506d-4872-b31e-3421ef85fd78

Syntax

ROUTETOMANY(userid_list)

Definition

Returns a list of RoutingIds for loginname. RoutingId list is then used to route the related workflow step to the users having ids in userid_list.

Parameters
userid_list Type: Guid. Required.
Example
userid_list Formula Result
[“jane.doe@kuika.com”, “john.doe@kuika.com

]

ROUTETOMANY(“jane.doe@kuika.com”, “john.doe@kuika.com) [00aafc7c-506d-4872-b31e-3421ef85fd78,

c16de123-1e36-426c-8cd5-4bfe8d243aae

Syntax

GetWorkflowInstanceReportsByDateInterval(appname, versionname, state, startdate, enddate)

Definition

Returns KuikaWorkflowInstanceReport list for dates between startdate-enddate, for version versionname of app appname for workflow instances in state state.

Parameters
appname Type: String. Required. Name of the app.
appversionname Type: String. Optional. Name of the app version.
state Type: String. Optional. Workflow instance state.
startdate Type: String. Optional. Defines start limit to workflow instance creation date.
enddate Type: String. Optional. Defines end limit to workflow instance creation date.
Example
appname appversionname state startdate enddate
“Test app” “Version 1” “RUNNING” “Tue Aug 01, 2017” “Fri Aug 18, 2017”

 

 

Formula Result
GetWorkflowInstanceReportsByDateInterval

(“Test app”,

“Version 1”,

“RUNNING”,

“Tue Aug 01, 2017”,

“Fri Aug 18, 2017”)

[{ WorkflowInstanceId : d18da3f4-9466-4810-a700-de2cd26eb169,

AppName :

“Test app”,

AppVersionName :

”Version 1”,

AppVersionId : a030f065-b553-4671-b983-f496956d8b2f,

StarterKuikaIdentityId : 34d1fdb1-cfc8-4327-9950-3f45ff4c2340,

State : “RUNNING”,

CreatedAt : “Wed Aug 2, 2017”,

LastUpdateAt : “Thu Aug 3, 2017”

}]

Syntax

GETEMAILOFIDENTITY(userid)

Definition

Returns email of identity with id userid.

Return type: String.

Parameters
userid Type: Guid. Required.
Example
userid Formula Result
1a3f9249-5c14-45c5-a603-e0d20fd6f6bc GETEMAILOFIDENTITY(userid) “john.doe@kuika.com”
Syntax

GETPHONEOFIDENTITY(userid)

Definition

Returns phone number of identity with id userid.

Return type: String.

Parameters
userid Type: Guid. Required.
Example
userid Formula Result
1a3f9249-5c14-45c5-a603-e0d20fd6f6bc GETPHONEOFIDENTITY(userid) “05001234567”

Syntax

GETSTEPURL(stepname, workflowinstance_id)

Definition

Returns url of a workflow step with name stepname, of a workflow instance with id workflowinstance_id.

Return type: String.

Parameters
stepname Type: String. Required.
workflowinstance_id Type: Guid. Required.
Example
stepname workflowinstance_id Formula Result
“Test step” 1a3f9249-5c14-45c5-a603-e0d20fd6f6bc GETSTEPURL(userid) “0500123456”
Syntax

NEWID()

Definition

Creates and returns a new domain entity.

Example
Formula Result
A = NEWID() New domain entity A
Syntax

GETDOMAINENTITYIDS(userid, domainname)

Definition

Returns domain entity ids corresponding to user with userid in domain domainname.

Return Type: List of Guids

Parameters
userid Type: Guid. Required. Id of a Kuika user.
domainname Type: String. Required. Name of a domain in Kuika.
Example
userid domainname Formula Result
149893d2-9804-4832-8776-3e93aa69e03a “Kuika” GETDOMAINENTITYIDS(userid, domainname) [1044dc4b-f43c-4db0-9ace-2ada2a4dcec1,

fe83464e-d906-4bec-80f4-9f5cb0706762,

b9b58855-1477-470d-a522-7e5dc98c753c]

Syntax

DOLLAR(amount, numdecimal)

Definition

Returns a string with a dollar sign and the specified amount, taking numdecimal digits after comma.

Return Type: String

Parameters
amount Type: Integer. Required.
numdecimal Type: Integer. Required. Number of digits to take after comma.
Example
amount numdecimal Formula Result
120 0 DOLLAR(120,0) “$120”
144.336 2 DOLLAR(amouınt,numdecimal) “$144.33”
Syntax

STARTAPP(appname)

Definition

Returns the workflow instance id of the app to start. This method serves to start a workflow instance from within another workflow instance.

Return Type: Guid

Parameters
appname Type: String. Required. The name of an app to be started.
Example
appname Formula Result
“Test App” STARTAPP(“Test App” 1e8d6b1c-fa78-44a1-85b8-a810fd960a6b

Syntax

NAVIGATEMAPTO(latitude, longitude)

No return value.

Definition

Opens a navigation application in your mobile phone and navigates to the location with coordinates latitude and longitude.

Parameters
latitude Type: Decimal. Required. Latitude of the desire location to navigate.
longitude Type: Decimal. Required. Longitude of the desire location to navigate.
Example
latitude longitude Formula Result
44.099 26.329 NAVIGATEMAPTO(latitude,longitude) No return value.
Syntax

LOGOUT()

Definition

Logs out of the Shell client.

Example
Formula Result
LOGOUT() Logs out of the Shell.
Syntax

ALERT(title, description, buttontext, alerttype)

Definition

Displays an alert button with the specified title, text, button, and type.

Example
Formula Result
ALERT(“Success!”, “Your message has been sent successfully!”, “OK”, “success”)
Syntax

TRIGGEREVENT(eventname)

Definition

This function can be used to call and trigger an event.

Parameters
eventname Type: String. Required. Name of the event to be triggered.
Example
Formula Result
TRIGGEREVENT(eventname) the event “eventname” is triggered and run.
Syntax

GETCURRENTLOCATION(latitude, longitude)

Definition

This function gets the current location coordinates, and then sets the parameters latitude and longitude to the current location values. For example you can use this function to displaying the current location on a map entity in your screen.