Working with Plan Functions
You can define plan functions in an Expression window, assign a unique name, and then use the functions to define new ADORs. At composition time, the ADOR values will be calculated based on the actual value of the evaluated function. The plan functions are for internal use in uPlan and are not available to the designer.
When creating new functions, you must select new unique names, and cannot create functions with the same names as those used for the built-in QLingo functions accessed through the templates. As a result, the following names are reserved for use as QLingo functions:
If/Else, Switch, Rand, Round, ABS, Floor, Ceil, FormatNumber, GetDay, GetMonth, GetYear, GetDayOfWeek, GetHour, GetMinute, GetSecond, Age, Now, FormatDate, Code 128, CODABAR, Code 39, EAN13, EAN8, Interleaved 2 of 5 (ITF), MSI (Modified Plessey), OneCode, POSTNET (USPSZIP), UPCA, UPCE, LCase, TCase, UCase, Length, SubString, Trim, LTrim, RTrim, Find, Replace, FindAndReplace, AsBoolean, AsDate, AsNumber, AsString, RowCount, UV2STR, IsFileExist, Abort, Format, ReportMessage, Skip, Call, GetEnv
For further information on QLingo functionality, refer to QLingo Language.
When you work with plan functions, various options are available by right clicking the Functions icon, or a specific function in the tree. When you right-click the Functions icon, a menu with the following options is displayed:
Option |
Description |
---|---|
New Function |
Create a new untitled plan function. Functions can be written in QLingo or JavaScript. |
New Group |
Create a new group of plan functions. |
Expand/Collapse All Groups |
Expand or collapse all groups so you can see or hide their contents. |
Paste |
Paste a previously cut or copied function into the list of plan functions. |
Order Functions |
Sort the functions by name or type. |
When you right-click a specific function group, a menu with the following options is displayed:
Option |
Description |
---|---|
New Function |
Create a new function in the current group. |
Rename |
Rename the current function group. |
Paste |
Paste a previously copied function into the current group. |
Delete |
Delete the currently selected group, provided it is empty. |
Order Functions |
Sort the functions inside the group, by name or type. |
When you right-click a specific function, a menu with the following options is displayed:
Option |
Description |
---|---|
New Parameter |
Insert a new untitled parameter into the currently selected function. |
Edit Expression |
Edit the function in an Expression window. |
Insert |
Insert the currently selected function into the active Expression window. |
Rename |
Rename the currently selected function. |
Type |
Define the type of function: Bool, Date, Number, or String. |
Move to Group |
Move the function into the selected group. |
Cut, Copy, Delete, Duplicate |
Cut, copy, delete, or duplicate the currently selected function. |
Order Parameters |
Sort the parameters by name or type. |
Right-clicking a specific function parameter displays a menu with the following options:
Option |
Description |
---|---|
Rename |
Rename the selected parameter. |
Type |
Define the type of parameter: Bool, Date, Number, or String. |
Cut, Copy, Delete, Duplicate |
Cut, copy, delete, or duplicate the currently selected parameter. |
Example of a Function Definition
This following figure illustrates the definition of a simple function that calculates the factorial of a number.
After we have defined the function, we can create a Text ADOR that uses the factorial.
For an example that further illustrates the use of plan functions, see Use Functions to Verify an ID Number.