Expressions
There are two types of expressions that can be used within a Workspaces configuration: env variables and helper functions.
Expressions are denoted by double braces; that is {{ ... }}.
Env variables
An env variable is an expression, embedded within a JSON element of a Workspaces configuration, that represents a dynamic value unknown to the Workspaces portal until runtime. Env variables are evaluated as soon as the JSON response is received on the client.
Usage
{{ ENV_VAR }}
ENV_VAR is one of the following:
currentUser: The login name of the current Workspaces user.
"filterBy": {
"$assigned": "{{ currentUser }}",
},
Helper functions
A helper function is an expression, embedded within a JSON element of a Workspaces configuration, that is evaluated to generate a dynamic value. Helper functions are evaluated when the JSON response is received.
date()
The date function is useful when a developer needs to define a date. By using natural language we can easily define relative dates.
Usage
{{ date('FORMAT') }}
FORMAT is a natural language string representing a specific day and/or time. Below are some example formats.
- A specific day -
'today','Sunday, January 15th 2012','8/25/1978','8-25-1978','8.25.1978','2012-12-31','2016-Mar-18','June 3rd, 2005','1 Dec. 2016' - A relative day -
'in half a year','two weeks from today','the end of next week','four days after Monday','two days after tomorrow','March 15th of last year','next Tuesday','next week Thursday' - A specific day in a month or year -
'the 4th of July','the 15th','the end of February','the last day of February','the beginning of this month','the 2nd Tuesday of November','22 August','the first day of 2013' - A specific or relative week, month or year -
'next week','April 2012','5-2002','last year','five years ago' - A relative time -
'in 30 minutes','half an hour ago','an hour from now' - A specific or relative day and time -
'3pm Wednesday','yesterday at 4pm','6:30pm in three days','next Saturday at 10am' - A timestamp -
'now','17760523T024508+0830','1997-07-16T19:20:30+01:00','08-25-1978 11:42:32.488am','Wed, 03 Jul 2008 08:00:00 EST'
"filterBy": {
"$stepAge": ["{{ date('1 week ago') }}", "{{ date('today') }}"]
},