Difference between revisions of "Functions"

From PresenceWiki
Jump to: navigation, search
(Index of Functions)
Line 9: Line 9:
 
This function compares String1 and String2. If they are equal it will return the value "true". Otherwise it will return "false".
 
This function compares String1 and String2. If they are equal it will return the value "true". Otherwise it will return "false".
  
* &if {testString, resultForTrue, resultForFalse}
+
* &if {"testString", "resultForTrue", "resultForFalse"}
  
 
This function performs a test on "testString". If it equals "true" or "1" the value of "resultForTrue" will be returned. Otherwise, "resultForFalse" will be returned.
 
This function performs a test on "testString". If it equals "true" or "1" the value of "resultForTrue" will be returned. Otherwise, "resultForFalse" will be returned.
Line 15: Line 15:
 
==== Data Functions ====
 
==== Data Functions ====
  
* onDemand {taskAlias, parameter+}
+
* &onDemand{"taskAlias", "parameter","Parm2"+}
  
 
Calls an On Demand Task.
 
Calls an On Demand Task.
Line 30: Line 30:
 
${id} = 5
 
${id} = 5
 
${now} = true
 
${now} = true
 +
 +
* &doesColumnExist{"COL_NAME"}
 +
Tests to see if the specified column name exists in the current data table - returns "true" if it does or "false" if not.
 +
 +
Parameter 1: The column name to test
 +
 +
  
 
==== Date Functions ====
 
==== Date Functions ====
Line 39: Line 46:
  
 
Returns: the current date in the format specified by the first parameter.
 
Returns: the current date in the format specified by the first parameter.
 +
 +
* &formatDate{"value_or_variable", "input format", "output format"}
 +
 +
===Date and Time Patterns===
 +
 +
'''G''' Era designator e.g. "AD"
 +
'''y''' Year e.g. yyyy="2015"; yy="15"
 +
'''M''' Month in year e.g. M="8" (August); MM="08"; MMM="Aug" MMMM="August"
 +
'''w''' Week in year e.g. w="33" (13/August/2015)
 +
'''W''' Week in month e.g. W="2" (13/August/2015)
 +
'''D''' Day in year e.g. D="225" (13/August/2015)
 +
'''d''' Day in month e.g d="13" (13/August/2015)
 +
'''F''' Day of week in month
 +
'''E''' Day in week e.g. E="Thu"
 +
'''a''' Am/pm marker
 +
'''H''' Hour in day (0-23)
 +
'''h''' Hour in day (1-12)
 +
'''m''' Minute in hour
 +
'''s''' Second in minute
 +
'''S''' Millisecond
 +
'''z''' Time zone e.g. z="BST";  zzzz="British Summer Time"
 +
'''Z''' Time zone (RFC 822 time zone) e.g Z="+0100"
 +
'''X''' Time zone (ISO 8601 time zone) e.g X="+01"; XX="+0100"; XXX="+01:00"

Revision as of 13:32, 13 August 2015

Index of Functions

This list aims to be a comprehensive list of default functions available with Presence 3.6.2. Please note that it is a work in progress.

Boolean Functions

  • &equalsString {String1, String2}

This function compares String1 and String2. If they are equal it will return the value "true". Otherwise it will return "false".

  • &if {"testString", "resultForTrue", "resultForFalse"}

This function performs a test on "testString". If it equals "true" or "1" the value of "resultForTrue" will be returned. Otherwise, "resultForFalse" will be returned.

Data Functions

  • &onDemand{"taskAlias", "parameter","Parm2"+}

Calls an On Demand Task.

taskAlias: The alias of the Task to be called parameter+ : The Parameters to be passed (zero or more).

eg:

&onDemand{"myTask","id=5", "now=true"}

Calls the Task referenced by the alias "myTask" and sets the following variables:

${id} = 5 ${now} = true

  • &doesColumnExist{"COL_NAME"}

Tests to see if the specified column name exists in the current data table - returns "true" if it does or "false" if not.

Parameter 1: The column name to test


Date Functions

  • &currentDate {format, offset}

format: The date format to use to format the current date (e.g. "dd/MM/yyyy"). offset: (Optional) The offset in days (e.g. -1, 1, 2, -5)

Returns: the current date in the format specified by the first parameter.

  • &formatDate{"value_or_variable", "input format", "output format"}

Date and Time Patterns

G Era designator e.g. "AD" y Year e.g. yyyy="2015"; yy="15" M Month in year e.g. M="8" (August); MM="08"; MMM="Aug" MMMM="August" w Week in year e.g. w="33" (13/August/2015) W Week in month e.g. W="2" (13/August/2015) D Day in year e.g. D="225" (13/August/2015) d Day in month e.g d="13" (13/August/2015) F Day of week in month E Day in week e.g. E="Thu" a Am/pm marker H Hour in day (0-23) h Hour in day (1-12) m Minute in hour s Second in minute S Millisecond z Time zone e.g. z="BST"; zzzz="British Summer Time" Z Time zone (RFC 822 time zone) e.g Z="+0100" X Time zone (ISO 8601 time zone) e.g X="+01"; XX="+0100"; XXX="+01:00"