Use functions when you are concatenating strings, formatting strings, counting records in a collection, and setting default values on a control. All functions begin with $_.
Function | |
---|---|
$_concat(param1, ...) : string | Converts and concatenates all parameters to a single string:
$_concat("StartDate: ", $LeaveRequests.StartDate, " - EndDate: ", $LeaveRequests.EndDate)You must provide at least one parameter. If you provide only one parameter, it is converted to a string and returned by the function. |
$_now() : date | Returns the current date and time as dateTime. |
$_format.date(date value, format option) : string | Returns the formatted string of a date value. Parameters include:
//returns for example "1 January 2012" if the date is 2012-01-01 and format option is long $_format.date($LeaveRequests.StartDate, long) //returns for example "1 Jan 2012" if the date is 2012-01-01 and format option is medium $_format.date($LeaveReuqests.StarDate, medium)The phone's region setting is used to format the date. |
$_format.datetime(date value, format option) : string | Returns the formatted string of a date and time value and supports these parameters:
//long format of today's date and time, result: "1 January 2012 11:55" $_format.datetime($_now(), long)The phone's region setting is used to format the date and time |
$_date(year, month, day) : date | Creates a date typed value from parameters and supports these parameters:
//returns "Since 1 January 2012" (UK locale was set on the phone) $_concat("Since", $_format.date($_date($_year($_now(), 1, 1)), long)) |
$_count(binding_id)
: int |
Returns the number of entries in a collection:
//returns Leave Requests (6) $_concat("Leave Requests (", $_count($LeaveRequests), ")") |
$_isNull(value) : int | Checks whether the parameter is a null value or nonexistent. Returns 0
(false) or 1 (true). |
$_isNotNull(value) : int | Checks whether the parameter value is null. . The function returns 1 (true)
if the parameter value is not a null value, or 0 (false) otherwise. |
$_isEmpty(value) : int | The function returns 1 (true) if:
|
$_isNotEmpty(value) : int | Returns true (1) for values for which $_isEmpty returns false (0). |
$_isExisting(value) : int | The function returns true (1) if its parameter refers to an existing
variable or data field of a BO; false (0) otherwise. The function also
returns true (1) when the referred variable or data field of a BO is null,
or empty string, or if it is an NSData instance with zero
length, because the parameter refers to an existing object. |
$_isNotExisting(value) : int | Returns true (1) for values for which $_isExisting returns
false (0). |
$_setValues(data_reference, value, [data reference, value], ...,
return value) : any | Sets one or more values in a business object with a given value, and returns
a value you select. Use this function to initialize fields of a new BO with
default values before showing it on a create screen. For example, in a new
leave request BO, you can write the start date, end date, approved ID,
approver name, and absence types into the appropriate fields before showing
the BO on the
screen. Example:
//The function sets the values of AbsenceTypeName and AbsenceTypeCode fields in the new leave request object and returns with the value of AbsenceTypeName of the given AbsenceTypes entry $_setValues("$LeaveRequestsNew.AbsenceTypeName", $AbsenceTypes.AbsenceTypeName, "$LeaveRequestsNew.AbsenceTypeCode", $AbsenceTypes.AbsenceTypeCode, $AbsenceTypes.AbsenceTypeName) |
$_year(date value) : int | Returns the year as an int from a date value:
//Returns the current year $_year($_now()) |