Expressions

An expression can consist of an arithmetic expression, property expression, query expression and logical expressions. E.g. 12 + 3 * 4 / 5 = 14, or #{principle} * #{rate} * 100 / #{time} where principle, rate and time are the identifiers, or #{Person.city} where a person is an identifier which points to data source object of Person and city is the property of a person.

Expressions can be used in Default value, Panel header, Trigger/Action condition properties of the UI elements.

Common Functions

Decode

Decode must be called with three or more String parameters

Returns: param3 if the param1 matches param2, param5 if param1 matches param4... 

In the below example, if gender is M, then Male will be returned, if gender is anything other than M or F, the actual value in gender will be returned. 

Example: decode(#{DataSource.gender}, 'M', 'Male', 'F', 'Female')

Evaluate

Evaluate must be called with 3 parameters (number, number, operator: LTE|GTE|LT|GT|EQ|<=|>=|<|>|==)

Returns: Boolean

Example: evaluate(1, 1, '==') returns true

Format

Format must be called with two parameters [Number or Date, String (format)]

Returns: String

Example: format(1000, '#,##0.00') will return "1,000.00"

format(#{session.sysdate}, 'MM/dd/yyyy')

IfNull

IfNull must be called with two parameters [Object, Object]

Returns: Null

The below example will return "X" if d.a is null

Example: ifNull(#{d.a}, 'X')

RowValue

RowValue must be called with one parameter [attributeName: String]. Will return the value of the given attribute from the current record.

Returns: Object

Example: rowvalue('attr')

ToNumber

ToNumber must be called with two parameters [String or Date, String (format)]

Returns: Double

Example: tonumber("10") ... tonumber(#{session.sysdate}, 'd') will return the day of the month for the given date

Date Functions

AddDate

AddDate must be called with two or three parameters Date, int, unit: String. Where unit must be one of the day (default), month, year, hour, minute, second, or a millisecond. 

Returns: Timestamp

Example: adddate(date, -1, 'day')

CurrDate

CurrDate must be called with no parameters e.g. currdate()

Returns: Timestamp

Example: currdate()

Date

Date must be called with 3-6 parameters e.g. Date(year, month, date[, hrs, min, sec]) e.g. Date(2017,1-12,1-31, 0-23, 0-59, 0-59)

Returns: Timestamp

Example: date(2017, 12, 30)

DateDiff

DateDiff must be called with two or three parameters (Date, Date, Unit: String. Where unit must be one of the day (default), month, year, hour, minute, second, or a millisecond. 

Returns: Double

Example: datediff(date1, date2, 'day')

DaysBetween

DaysBetween must be called with 1 to 6 parameters ( Date fromDate, Date toDate, boolean isWeekDays [false], String dataSourceNameOfHolidayDates, String itemIdOfStore, String attributeNameOfHolidays [holiday])

Returns: Double

Example: daysbetween(fromDate, toDate, true) will return the total weekdays between the two dates

GetDaysInMonth

GetDaysInMonth must be called with 1 to 8 parameters (Double month, Double year [current year], boolean isWeekDays [true], Date fromDate [start of month], Date toDate [end of month], String dataSourceNameOfHolidayDates, String itemIdOfStore, String attributeNameOfHolidays [holiday])

Returns: Double

Example: getDaysInMonth(1, 2017, true)

IsSameDate

IsSameDate must be called with two date parameters

Returns: Boolean

Example: issamedate(date1, date2)

IsWeekEnd

IsWeekEnd must be called with one or three parameters (date: Date, day: int, periodFrequency: F|M|W)

Returns: Timestamp

Example: isweekend(param1, param2)

StartingDayOfWeek

StartingDayOfWeek must be called with no parameters

Returns: Double

Example: startingdayofweek(param1, param2)

TrimDate

TrimDate must be called with one parameter Date

Returns: Timestamp

Example: trimdate(param1, param2)

WeekDaysBetween

WeekDaysBetween must be called with two date parameters

Returns: Double

Example: weekdaysbetween(param1, param2)

Math Functions

Abs

Abs must be called with a single parameter [Number]

Returns: Double

Example: abs(param1, param2)

Avg

Avg must be called with one parameter [String]

Returns: Double

Example: avg(param1, param2)

GroupMax

GroupMax must be called with one parameter [String]

Returns: Double

Example: groupmax(param1, param2)

GroupMin

GroupMin must be called with one parameter [String]

Returns: Double

Example: groupmin(param1, param2)

Max

Max must be called with two parameters [Number, Number]

Returns: Double

Example: max(param1, param2)

Min

Min must be called with two parameters [Number, Number]

Returns: Double

Example: min(param1, param2)

Mul

Mul must be called with one parameter [String]

Returns: Double

Example: mul(param1, param2)

Round

Round must be called with a single parameter [Number]

Returns: Double

Example: round(param1, param2)

Sum

Sum must be called with one parameter [String]

Returns: Double

Example: sum(param1, param2)

String Functions

CharAt

CharAt must be called with two parameters [String, int]

Returns: String

Example: charat(param1, param2)

Concat

Concat must be called with two or more parameter

Returns: String

Example: concat(param1, param2)

Contains

Contains must be called with two parameters [String, String]

Returns: Boolean

Example: contains(param1, param2)

EndsWith

EndsWith must be called with two parameters [String, String]

Returns: Boolean

Example: endswith(param1, param2)

EqualsIgnoreCase

EqualsIgnoreCase must be called with two parameters [String, String]

Returns: Boolean

Example: equalsignorecase(param1, param2)

IndexOf

IndexOf must be called with two parameters [String, String]

Returns: Double

Example: indexof(param1, param2)

Replace

Replace must be called with three parameters [String, target, replacement]

Returns: String

Example: replace(param1, param2)

ReplaceAll

ReplaceAll must be called with three parameters [String, regex, replacement]

Returns: String

Example: replaceall(param1, param2)

StartsWith

StartsWith must be called with two parameters [String, String]

Returns: Boolean

Example: startswith(param1, param2)

SubString

SubString must be called with two or three parameters [String, int, int (optional)]

Returns: String

Example: substring(param1, param2)

ToLowerCase

ToLowerCase must be called with a single parameter [String]

Returns: String

Example: tolowercase(param1, param2)

ToUpperCase

ToUpperCase must be called with a single parameter [String]

Returns: String

Example: touppercase(param1, param2)

Trim

Trim must be called with a single parameter [String]

Returns: String

Example: trim(param1, param2)

Ui Functions

ClearDataSource

ClearDataSource must be called with one parameter (DataSource)

Returns: Boolean

Example: cleardatasource(param1, param2)

Commit

Commit must be called without any parameters

Returns: Boolean

Example: commit(param1, param2)

ConfirmOk

ConfirmOk must be called with two or three parameters (Title, Message,[Align to item id]

Returns: Boolean

Example: confirmok(param1, param2)

ConfirmOkCancel

ConfirmOkCancel must be called with two parameters (Message (String), CallBack

Returns: Boolean

Example: confirmokcancel(param1, param2)

ConfirmYesNoCancel

ConfirmYesNoCancel must be called with two parameters (Message (String), CallBack

Returns: Boolean

Example: confirmyesnocancel(param1, param2)

CopyRecord

CopyRecord must be called with two or three parameters (source record ,target record, makeDirty [boolean: default true])

Returns: Record

Example: copyrecord(param1, param2)

Deferre

Deferre must be called with one parameters (Integer)

Returns: Boolean

Example: deferre(param1, param2)

DoQuery

DoQuery must be called with two parameters (DataSource, Model Name)

Returns: Boolean

Example: doquery(param1, param2)

GetContextRecord

GetContextRecord must be called without any parameters

Returns: Record

Example: getcontextrecord(param1, param2)

GetCurrentRecord

GetCurrentRecord must be called with either one or two parameter (Datasource Name, [Target itemId])

Returns: Record

Example: getcurrentrecord(param1, param2)

GetGridColumnsTotal

GetGridColumnsTotal must be called with 4 parameters [gridItemId, valueItemId,displayAttribute,displayAttribute]

Returns: Boolean

Example: getgridcolumnstotal(param1, param2)

GetIconHtml

GetIconHtml must be called with one string parameter (Icon name e.g. icon-search)

Returns: String

Example: geticonhtml(param1, param2)

GetModelValue

GetModelValue must be called with two parameters (Model Name & Attribute)

Returns: Object

Example: getmodelvalue(param1, param2)

GetProfileValue

GetProfileValue must be called with one parameter (Profile Code)

Returns: Object

Example: getprofilevalue(param1, param2)

GetRecord

GetRecord must be called with two or more parameters (Datasource Name, Target itemId [optional], rownum: int)

Returns: Record

Example: getrecord(param1, param2)

GetRecordByKeyValues

GetRecordByKeyValues must be called with three or more parameters (DataSource, Key1 (String), Value1 (Object), Key2, Value2, Key3...)

Returns: Record

Example: getrecordbykeyvalues(param1, param2)

Ui Functions [G]

GetRecordStatus

GetRecordStatus must be called with 1 parameter (record)

Returns: String

Example: getrecordstatus(param1, param2)

GetRecordValue

GetRecordValue must be called with two parameters (Record & Attribute)

Returns: Object

Example: getrecordvalue(param1, param2)

GetResultValue

GetResultValue must be called with two parameters (Model Name & Attribute)

Returns: Object

Example: getresultvalue(param1, param2)

GetRowCount

GetRowCount must be called with one or more parameters (DataSource, Key1 (String), Value1 (Object), Key2, Value2, Key3...)

Returns: Double

Example: getrowcount(param1, param2)

GoToRecord

GoToRecord must be called with two or more parameters (Grid Item Id,key,value,key,value......)

Returns: Boolean

Example: gotorecord(param1, param2)

GoToRecordByIndex

GoToRecordByIndex must be called with two parameters (Grid Item Id,Row Index)

Returns: Boolean

Example: gotorecordbyindex(param1, param2)

GoToTarget

GoToTarget must be called with a single parameter [String]

Returns: Boolean

Example: gototarget(param1, param2)

HasRole

HasRole must be called with String parameter (rolecode)

Returns: Boolean

Example: hasrole(param1, param2)

HasRoleCategory

HasRoleCategory must be called with String parameter (rolecategory)

Returns: Boolean

Example: hasrolecategory(param1, param2)

HideColumn

HideColumn must be called with three or more parameters [GridItemId, ColumnItemId...,Boolean]

Returns: Boolean

Example: hidecolumn(param1, param2)

HideForceSelectionColumn

HideForceSelectionColumn must be called with two parameters [GridItemId,Boolean]

Returns: Boolean

Example: hideforceselectioncolumn(param1, param2)

InitModel

InitModel must be called with two parameters (Model Name, DataSource)

Returns: Boolean

Example: initmodel(param1, param2)

InsertRow

InsertRow must be called with two parameters (DataSource, Model Name)

Returns: Boolean

Example: insertrow(param1, param2)

InvokeAction

InvokeAction must be called with one parameters (Item Id)

Returns: Boolean

Example: invokeaction(param1, param2)

InvokeQueryService

InvokeQueryService must be called with one or two (Model Name, CallBack

Returns: Boolean

Example: invokequeryservice(param1, param2)

Ui Functions [I]

InvokeService

InvokeService must be called with one or two parameters [Model Name, CallBack]

Returns: Boolean

Example: invokeservice(param1, param2)

InvokeValidateService

InvokeValidateService must be called with one or two parameters [DataSource Name, CallBack]

Returns: Boolean

Example: invokevalidateservice(param1, param2)

IsChanged

IsChanged must be called with single parameter (DataSource)

Returns: Boolean

Example: ischanged(param1, param2)

Pause

Pause must be called with one parameters (Milliseconds(int))

Returns: Boolean

Example: pause(param1, param2)

Refresh

Refresh must be called with one parameter (DataSource)

Returns: Boolean

Example: refresh(param1, param2)

ResetDynamicFormPanel

ResetDynamicFormPanel must be called with two parameters (ItemId, Model Name)

Returns: Boolean

Example: resetdynamicformpanel(param1, param2)

ResetFormPanel

ResetFormPanel must be called with two or three parameters (ItemId, Model Name, [Use View Attribute (boolean)])

Returns: Boolean

Example: resetformpanel(param1, param2)

SetCollapsed

SetCollapsed must be called with two or more parameters [String..., Boolean]

Returns: Boolean

Example: setcollapsed(param1, param2)

SetColumnHeader

SetColumnHeader must be called with three parameters [GridItemId, ColumnItemId,String]

Returns: Boolean

Example: setcolumnheader(param1, param2)

SetEnabled

SetEnabled must be called with two or more parameters [String..., Boolean]

Returns: Boolean

Example: setenabled(param1, param2)

SetGroupColumnHeading

SetGroupColumnHeading must be called with three parameters [GridItemId, ColumnItemId,String]

Returns: Boolean

Example: setgroupcolumnheading(param1, param2)

SetHeading

SetHeading must be called with two parameter [ItemId, Title]

Returns: Boolean

Example: setheading(param1, param2)

SetInsertAllowed

SetInsertAllowed must be called with two or more parameters [String..., Boolean]

Returns: Boolean

Example: setinsertallowed(param1, param2)

SetModelValue

SetModelValue must be called with three parameters (Model Name, Attribute, Value)

Returns: Boolean

Example: setmodelvalue(param1, param2)

SetReadOnly

SetReadOnly must be called with two or more parameters [String..., Boolean]

Returns: Boolean

Example: setreadonly(param1, param2)

SetRecordStatus

SetRecordStatus must be called with two string parameters [DataSource Name, Status (New,Insert,Query,Update]

Returns: Boolean

Example: setrecordstatus(param1, param2)

Ui Functions [S]

SetRecordValue

SetRecordValue must be called with three parameters (Record & Attribute & value)

Returns: Boolean

Example: setrecordvalue(param1, param2)

SetRequired

SetRequired must be called with two or more parameters [String..., Boolean]

Returns: Boolean

Example: setrequired(param1, param2)

SetUpdateAllowed

SetUpdateAllowed must be called with two or more parameters [String..., Boolean]

Returns: Boolean

Example: setupdateallowed(param1, param2)

SetValue

SetValue must be called with two or three parameters (Target DataSource.Attribute, Value & isMakeDirty [default true])

Returns: Boolean

Example: setvalue(param1, param2)

SetVisible

SetVisible must be called with two or more parameters [String..., Boolean]

Returns: Boolean

Example: setvisible(param1, param2)

SetWindowTitle

SetWindowTitle must be called with a single parameter [String]

Returns: Boolean

Example: setwindowtitle(param1, param2)

ShowAlert

ShowAlert must be called with two parameters [Title (String), Message (String) or Global values]

Returns: Boolean

Example: showalert(param1, param2)

ShowError

ShowError must be called with two parameters [Title, Message]

Returns: Boolean

Example: showerror(param1, param2)

ShowInfo

ShowInfo must be called with two parameters [Title (String), Message (String) or Global values]

Returns: Boolean

Example: showinfo(param1, param2)

ShowInstruction

ShowInstruction must be called with two or more parameters (Message, Align to item id, Hide Delay(ms), Width, Height, X offset, Y offset

Returns: Boolean

Example: showinstruction(param1, param2)

ShowStatus

ShowStatus must be called with one parameter [String]

Returns: Boolean

Example: showstatus(param1, param2)

SilentRefresh

SilentRefresh must be called with one parameter (DataSource)

Returns: Boolean

This function can be used to refresh a grid on the background without showing the loading message to the user.

Example: silentrefresh('DataSourceName')

Ui

Ui must be called with two or more parameters

Returns: Boolean

Example: ui(param1, param2)