|Top Previous Next|
There are several built in functions that you can use within trigger condition or trigger action fields. These functions are particularly useful in cases where you want to format or parse a trigger event variable. For a list of available functions, just click the Functions or Add Function button when creating a trigger in MFT Server Manager. If you hover your mouse over a function in the list, a tooltip/context sensitive help will appear. Each tooltip contains a short description of the function and an example.
Each trigger listens for a server event which in turn has several event variables that you can use in your trigger actions when executed. These event variables may be used in functions as well. For example, let's assume you are listening for the File Upload event and you want to rename the file to an upper case version of it's filename with a .RENAMED file extension. To achieve this you would create a trigger that listens for File Upload event and executes a Rename File action. The Rename File action has two required fields, File and Destination File, which would be as follows:
Destination File: %LocalDir%\%ToUpperCase(Name)%.RENAMED
In this case the ToUpperCase function is used, it's argument being the name of the file uploaded as represented by the Name event variable.
The Format function is very powerful in that it allows you to format data in a language neutral way. The most common use is in the formatting of dates. For example, assume that you need to get numeric month and day of month values in the format MM-DD. To achieve this you could use the Month and DayOfMonth event variables. The problem however is that the Month and DayOfMonth event variables return integer values, not strings, returning the incorrect format for months and days whose values fall between 1 and 9. To resolve this issue you must use the Format function to format the Month and DayOfMonth values in the desired format. The example below demonstrates how a MM-DD format could be achieved.
The Format function uses the java.text.MessageFormat class that is provided as part of the JDK. For more information on how patterns may be used, please consult the JavaDoc documentation for this class available at: