A function specifies a parameter for a special field that automatically changes the value of that field whenever a letter is generated. The Create Letter Function option allows you to specify simple VBScript functions accepting just one parameter (@P1), the results of which would be printed on the letter.
Note
Currently server-side Letters lack support for letter functions and post-merge macro functions.
The script is evaluated using the ScriptControl eval function. It must be an expression and must return a single value. For information on the available functions and how eval works, refer to the VBScript reference manual. For information on the VBScript Language, visit MSDN.Microsoft.com and search for VBSCRIPT REFERENCE.
Note
After creating a letter function, you must associate a parameter with the letter function. For details, refer to To Associate a Parameter with a Letter Function.
Example 1:
You can create a function that adds a certain number of days to a date for the letter. You may want to do this to add a certain number of days from the application date before an action needs to take place. Or, add the number of days from the move-in that an action needs to take place.
For example, to add seven days to a date, specify DateAdd(“d”, 7,@P1) as the script. Then, when a merge template is created, you can specify the parameter date field of LeaseEndsDate, for example. When the letter is printed in eSite, if the lease ends date is 02/02/2002, the function field will reflect 02/09/2002 (it adds seven days to the date).
Example 2:
You can create a function that pulls the first four characters or digits of a value, such as a Unit ID. For example, if the script is Left(@P1,3), the parameter specified at the time of the data template creation is Unit. If you have unit IDs in the system that consist of the building number and unit number, you can separate the value by pulling just the building number.
In eSite, the Unit ID is 001101. However, the Unit ID consists of the real Building ID 001 and the Unit ID 101. The function field on the letter generated will reflect 001 (the left three digits of the Unit, which represent the building number).
Note
Example 2 could be modified to reflect the right characters (for example, to find the last four digits of a resident’s social security number). To do so, replace "Left" in the Function Text with "Right," as in Right(@P1,4).
See Also
Create Letter Function Details Tab
To Associate a Parameter with the Letter Function
Setup Questions for Create Letter Function Details
Copyright © 2018 Infor. All rights reserved. www.infor.com.