about us      downloads      documentation      contact      home 
 products
 antHR
 workflow studio
 technical toolkits
 content entry
 workflow
 security
 hierarchy
 concepts
 how tos
 reference
 FAQs

Scripting language

In many situations you can use a scripting language to display information from the workflow case. This language allows for a set of formatting commands and allows access to the case through the standard XPath language.

By right clicking in text boxes that require scripting language, you are given a menu which authors scripting commands.

Examples

In each of these examples I will use a case which has the following definition. Case is called "Example". Fields are, date field called "FromDate", date field called "ToDate", string field called "Reason", upload field called "DelegationPlans". It also has a group called "Comments", string field in group Comments called "ActualComment". This leads to an XML record of the form:
<Example>
	<ToDate>2002-08-17T00:00:00</ToDate>
	<FromDate>2002-09-17T00:00:00<</FromDate>
	<Reason>I would like to take a long weekend</Reason>
	<DelegationPlans></DelegationPlans>
	<Comments>
		<Comment><ActualComment>Approved</ActualComment></Comment>
	</Comments>
</Example>
					
Example 1: Produce an email showing the from and to dates.

Script: Can {$FullName(Owner)} take holiday between {$FormatDate(FromDate, "MMMM dd yyyy")} and {$FormatDate(ToDate, "MMMM dd yyyy")}. He/she wants to take it for the reason: {Reason}


Output: Can Joe Bloggs take holiday between August 18 2002 and August 19 2002. He/she wants to take it for the reason: I would like to take a long weekend.

Starting from the right hand side, in order to reproduce the reason from the case document you can merely open a curly bracket { and put the name of the field then close the curly bracket }.
To produce a formatted date you need to use a command, FormatDate, which is used to specify how the date is to be displayed. See the from date and the to date formatting.
Finally in order to show who asked for the holiday you can use the Owner responsible string which returns the owner of the workflow (see here for other examples of responsible strings). Then the FullName command is used on this user in order to get a display version of the user's name.

Command reference

Command Parameters Description Example
FullName User: Responsible string Taking a responsible string as a parameter and replaces it with full username of the user. FullName(Owner)
LinkBinary Binary: XPath to the field of that contains the binary
InnerText: Text that is displayed as a link
Take an XPath to a binary in the field, and provides a link to a download with the text of the second parameter LinkBinary(DelegationPlans, "download")
FormatDate Date: XPath to the field of that contains the date
FormatString: Format string
This command takes a date and a format string and produces a formatted date as output. Examples of a format string are listed below.
d :08/17/2000
D :Thursday, August 17, 2000
f :Thursday, August 17, 2000 16:32
F :Thursday, August 17, 2000 16:32:32
g :08/17/2000 16:32
G :08/17/2000 16:32:32
m :August 17
r :Thu, 17 Aug 2000 23:32:32 GMT
s :2000-08-17T16:32:32
t :16:32
T :16:32:32
u :2000-08-17 23:32:32Z
U :Thursday, August 17, 2000 23:32:32
y :August, 2000
dddd, MMMM dd yyyy :Thursday, August 17 2000
ddd, MMM d "'"yy :Thu, Aug 17 '00
dddd, MMMM dd :Thursday, August 17
M/yy :8/00
dd-MM-yy :17-08-00
FormatDate("ToDate", "dd-MM-yyyy")

Did you find this article helpful? Comments on this page are welcome and can only help us improve the quality of our documentation.
© Ant Organisation Ltd, 2003