Create Letter Functions Overview

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.

NoteNote

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.

NoteNote

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).

  1. From the eSite menu, select Setup—Letters—Create Letter Functions.
  2. From the Create Letter Functions grid, click Add Letter Function.
  3. From the Create Letter Function Details Tab, type the Function Name (for example, "DatePlus7").
  4. Type a Function Description (for example, "Add 7 days to date" ).
  5. In the Function Text field, type dateadd(“d”,7,@P1).
  6. Click Verify Script.
  7. In the parameter window that appears, type a date (mm/dd/yyyy) and click Save.
  8. Review the script results in the parameter window. For example, if you entered 02/02/2002, the resulting date should be seven days later (02/09/2002).
  9. Click OK.
  10. Click Save.

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).

  1. From the eSite menu, select Setup—Letters—Create Letter Functions.
  2. From the Create Letter Functions grid, click Add Letter Function.
  3. From the Create Letter Function Details Tab, type the Function Name (for example, "Left3Chars").
  4. Type a Function Description (for example, "Pull the first 3 characters").
  5. In the Function Text field, type Left(@P1,3).
  6. Click Verify Script.
  7. In the parameter window that appears, type a name and click Save.
  8. Review the script results in the parameter window. For example, if you entered 001101, the resulting date should be the first four characters from the left (001).
  9. Click OK.
  10. Click Save.

Note 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 Functions Grid

Create Letter Function Details Tab

Effect of Browsers on Letters

To Associate a Parameter with the Letter Function

To Add a Letter Function

To Edit a Letter Function

To Delete a Letter Function

Setup Questions for Create Letter Function Details

Data Templates

Form Letters

Assign Merge Locations

Letters Setup Overview

Letters Overview

 

Copyright © 2018 Infor. All rights reserved. www.infor.com.