Inside Activate
Development
Understanding Expression Evaluation and Functions
3 min
activate expressions start with an "=" sign these expressions can be evaluated at different times depending upon the context that they are being used the general rule is that expressions are evaluated only when the value is needed expressions can be wrapped in quotes " to stop the parser interpreting special characters for example =eval(=//roles/my newrole) would actually be intepreted as =eval( \[=//roles/my] minus \[newrole] ) which is not the desired result however =eval("=//roles/my newrole") would work as expected expressions passed to a function are evaluated at that point and the result is passed to the function for example, consider the following example \<groups> \<group>=//resources/groups/group1\</group> \<group>=//resources/groups/group2\</group> \<group>=//resources/groups/group3\</group> \</groups> if you wanted to use a foreach statement to display a list of the names you could write the following 1\ =foreach(=/groups/group, "=/name") 2\ =foreach(=/groups/group, =/name) 3\ =foreach(=/groups/group, "%=/name%") however, only one example is correct number 3 explanation all expressions starting with = or strings starting with "=xxxx" are evaluated and passed to the function 1\ =foreach(=/groups/group, "=/name") the first argument will return the list of groups and the second argument will be evaluated immediately and return the 'name' of the current context probably the job or ""; arguments passed to the function =foreach(xmllist {group1,group2,group3}, string ””) result "" each group is looped over an an empty string is added to the result 2\ =foreach(=/groups/group, =/name) this is exactly the same as the previous example 3\ =foreach(=/groups/group, "%=/name%") the %= stops the expression being evaluated by the parser and passes it to the function as is therefore, what gets passed to the function is =foreach(xmllist {group1,group2,group3}, string ”%=/name% ”) now evaluating the %=/name% for each item in the list will give the expected result result group1 group2 group3