Developer

Functions

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 $_.

Supported functions include:
    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:
    • date value – date typed value.
    • format option – valid values are: short, medium, long
    Examples:
     //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:
    • date value – date typed value.
    • format option – valid values are: short, medium, long.
    Example:
     //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:
    • year – year value as int or float.
    • month – month value as int or float.
    • day – day value as int or float.
    Example:
    //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 false or true.
  • $_isNotNull(value) : int Checks whether the parameter value is null. Returns true if the parameter value is not a null value, or false otherwise.
  • $_isEmpty(value) : int The function returns true if:
    • Its parameter is a null value.
    • The referred variable or data field of a BO in its parameter does not exist.
    • The referred variable or data field of a BO exists, but its value is either an empty string ('') or an NSData instance with zero length.
    Otherwise, this function returns false.
  • $_isNotEmpty(value) : int Returns true for values for which $_isEmpty returns false.
  • $_isExisting(value) : int The function returns true if its parameter refers to an existing variable or data field of a BO; false otherwise. The function also returns true when the referred variable or data field of a BO is null, or empty string, because the parameter refers to an existing object.
  • $_isNotExisting(value) : int Returns true for values for which $_isExisting returns false).
  • $_year(date value) : int Returns the year as an int from a date value:
     //Returns the current year   
    $_year($_now())