Difference between revisions of "Functions"
Line 5: | Line 5: | ||
==== Boolean Functions ==== | ==== Boolean Functions ==== | ||
− | + | ===== &equalsString{VAL1, VAL2} ===== | |
− | + | ||
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". | ||
+ | <pre>&equalsString{"ABC","ABC"}</pre> Returns true <pre>&equalsString{"ABC","BC"}</pre> Returns false | ||
+ | |||
+ | |||
+ | ===== &if{VALUE, TRUE_RESULT, FALSE_RESULT} ===== | ||
− | + | This function performs a test on a string. If it equals "true" or "1" the value of Parameter 2 will be returned. Otherwise, value of Parameter 3 will be returned. | |
− | + | <pre>&if{"true", "I AM TRUE", "I AM FALSE"}</pre> Returns "I AM TRUE" <pre>&if{"0", "I AM TRUE", "I AM FALSE"}</pre> Returns "I AM FALSE" | |
==== Data Functions ==== | ==== Data Functions ==== | ||
− | + | ===== &onDemand{taskAlias, parameter+} ===== | |
− | Calls an On Demand Task. | + | Calls an On Demand Task that is on the Live Task Queue. |
− | taskAlias: The alias of the Task to be called | + | taskAlias: The alias of the Task to be called, the task should be on the [[Live Tasks Queue #On Demand Processes]] |
− | + | ||
− | + | parameter+ : The Parameters to be passed (zero or more). | |
− | &onDemand{"myTask","id=5", "now=true"} | + | <pre>&onDemand{"myTask","id=5", "now=true"}</pre> |
Calls the Task referenced by the alias "myTask" and sets the following variables: | Calls the Task referenced by the alias "myTask" and sets the following variables: | ||
Line 31: | Line 33: | ||
${now} = true | ${now} = true | ||
− | + | If the task returns a magic ${response} variable that value will be populated in the variable or space you are calling the function from. | |
+ | |||
+ | ===== &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. | 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 | Parameter 1: The column name to test | ||
− | |||
==== Date Functions ==== | ==== Date Functions ==== | ||
− | + | ===== ¤tDate{format, offset} ===== | |
− | format: The date format to use to format the current date (e.g. "dd/MM/yyyy"). | + | Returns: the current date in the format specified by the first parameter. |
+ | |||
+ | format: The date format to use to format the current date (e.g. "dd/MM/yyyy"). See [[#Date and Time Patterns=]] | ||
offset: (Optional) The offset in days (e.g. -1, 1, 2, -5) | offset: (Optional) The offset in days (e.g. -1, 1, 2, -5) | ||
− | Returns | + | <pre>¤tDate{"MMM/YYYY"}</pre> Returns Aug/2015 <pre>¤tDate{"dd/MM/YYYY"}</pre> Returns 13/08/2015 or whatever the current date is. <pre>¤tDate{"dd/MM/YYYY",-5}</pre> Returns 08/08/2015 (minus 5 days from the current date) <pre>¤tDate{"dd/MM/YYYY",-3M}</pre> Returns 13/05/2015 (minus 3 months from the current date) <pre>¤tDate{"dd/MM/YYYY",5}</pre> Returns 18/08/2015 (plus 5 days from the current date) |
* &formatDate{"value_or_variable", "input format", "output format"} | * &formatDate{"value_or_variable", "input format", "output format"} | ||
− | + | Returns: a new format for a date passed into the function on parameter 1 the current date in the format specified by the first parameter. | |
===Date and Time Patterns=== | ===Date and Time Patterns=== | ||
'''G''' Era designator e.g. "AD" | '''G''' Era designator e.g. "AD" | ||
+ | |||
'''y''' Year e.g. yyyy="2015"; yy="15" | '''y''' Year e.g. yyyy="2015"; yy="15" | ||
+ | |||
'''M''' Month in year e.g. M="8" (August); MM="08"; MMM="Aug" MMMM="August" | '''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 year e.g. w="33" (13/August/2015) | ||
+ | |||
'''W''' Week in month e.g. W="2" (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 year e.g. D="225" (13/August/2015) | ||
+ | |||
'''d''' Day in month e.g d="13" (13/August/2015) | '''d''' Day in month e.g d="13" (13/August/2015) | ||
+ | |||
'''F''' Day of week in month | '''F''' Day of week in month | ||
+ | |||
'''E''' Day in week e.g. E="Thu" | '''E''' Day in week e.g. E="Thu" | ||
+ | |||
'''a''' Am/pm marker | '''a''' Am/pm marker | ||
+ | |||
'''H''' Hour in day (0-23) | '''H''' Hour in day (0-23) | ||
+ | |||
'''h''' Hour in day (1-12) | '''h''' Hour in day (1-12) | ||
+ | |||
'''m''' Minute in hour | '''m''' Minute in hour | ||
+ | |||
'''s''' Second in minute | '''s''' Second in minute | ||
+ | |||
'''S''' Millisecond | '''S''' Millisecond | ||
+ | |||
'''z''' Time zone e.g. z="BST"; zzzz="British Summer Time" | '''z''' Time zone e.g. z="BST"; zzzz="British Summer Time" | ||
+ | |||
'''Z''' Time zone (RFC 822 time zone) e.g Z="+0100" | '''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" | '''X''' Time zone (ISO 8601 time zone) e.g X="+01"; XX="+0100"; XXX="+01:00" |
Revision as of 14:15, 13 August 2015
Contents
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{VAL1, VAL2}
This function compares String1 and String2. If they are equal it will return the value "true". Otherwise it will return "false".
&equalsString{"ABC","ABC"}Returns true
&equalsString{"ABC","BC"}Returns false
&if{VALUE, TRUE_RESULT, FALSE_RESULT}
This function performs a test on a string. If it equals "true" or "1" the value of Parameter 2 will be returned. Otherwise, value of Parameter 3 will be returned.
&if{"true", "I AM TRUE", "I AM FALSE"}Returns "I AM TRUE"
&if{"0", "I AM TRUE", "I AM FALSE"}Returns "I AM FALSE"
Data Functions
&onDemand{taskAlias, parameter+}
Calls an On Demand Task that is on the Live Task Queue.
taskAlias: The alias of the Task to be called, the task should be on the Live Tasks Queue #On Demand Processes
parameter+ : The Parameters to be passed (zero or more).
&onDemand{"myTask","id=5", "now=true"}
Calls the Task referenced by the alias "myTask" and sets the following variables:
${id} = 5 ${now} = true
If the task returns a magic ${response} variable that value will be populated in the variable or space you are calling the function from.
&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
¤tDate{format, offset}
Returns: the current date in the format specified by the first parameter.
format: The date format to use to format the current date (e.g. "dd/MM/yyyy"). See #Date and Time Patterns= offset: (Optional) The offset in days (e.g. -1, 1, 2, -5)
¤tDate{"MMM/YYYY"}Returns Aug/2015
¤tDate{"dd/MM/YYYY"}Returns 13/08/2015 or whatever the current date is.
¤tDate{"dd/MM/YYYY",-5}Returns 08/08/2015 (minus 5 days from the current date)
¤tDate{"dd/MM/YYYY",-3M}Returns 13/05/2015 (minus 3 months from the current date)
¤tDate{"dd/MM/YYYY",5}Returns 18/08/2015 (plus 5 days from the current date)
- &formatDate{"value_or_variable", "input format", "output format"}
Returns: a new format for a date passed into the function on parameter 1 the current date in the format specified by the first parameter.
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"