Expression Builder Overview
When you use the Expression Builder to create conditional rules, the basic process is to insert items into the expression until it is completed. That is, you do not type the expression manually. The Expression Builder provides a convenient way to insert many objects, operators, and functions in your expressions. These include the following:
-
Operators
+ Addition operator (Use to add two values) – Subtraction operator (Use to subtract one value from another) * Multiplication operator (Use to multiply one value by another) / Division operator (Use to divide one value by another) = Equal sign (Use to set a specific value for a variable) < Less than comparison operator (Use to compare whether one value is less than another) ≤ Less than or equal comparison operator (Use to compare whether one value is less than or equal to another) > Greater than comparison operator (Use to compare whether one value is greater than another) ≥ Greater than or equal comparison operator (Use to compare whether one value is greater than or equal to another) = = Equality comparison operator (Use to compare whether two values are equivalent) ! = Inequality comparison operator (Use to compare whether two values are not equivalent) && AND logical operator (Use to link two parts of an expression in an AND logical relation) || OR logical operator (Use to link two parts of an expression in an OR logical relation) ! NOT logical operator (Use to create an expression that is best expressed in a negative way—that is, you place the NOT operator before a condition so that it evaluates a condition that is not true.) ( Left parenthesis (Use with a matching right parenthesis to group elements of an expression in order to control precedence.) ) Right parenthesis (Use with a matching left parenthesis to group elements of an expression in order to control precedence.) -
Edit buttons
The bottom pane, where you build the expression, contains buttons to help you edit the expression, such as undo, copy, and paste buttons. You can also right-click to access a menu with the same options.
-
User functions
You can access these functions by expanding the user category within the objects category. These functions enable you to get information related to the current user, such as the employee number, company number, user attributes, and whether the user is a customer. The information available for a user is generally that from the attributes in the user's Lawson LDAP user record. See the User Functions table below for more detail.
-
Form, file, and resource objects
You can access these objects by expanding the form, table, or resource type category within the objects category. If you are writing a rule for an application form (such as HR11.1) or for a file (table), the Expression Builder provides a list of the fields so that you can reference the values of those fields in the expression. If you are writing a rule for a Resource Management object (such as a group, resource, role, or structure), the Expression Builder provides a list of the attributes for the object as well as a function for checking the value of the attribute.
You can also access these objects by typing the object type name and then pressing Ctrl+Space. For example, you can type "table." and then press Ctrl+Space in order to see a list of the fields in the table or file.
-
Global functions
You can access these functions by expanding the utility functions category within the other category. These functions allow you to reformat data and work with a variety of Resource Management information, including structures, identities, agents, attributes, and groups. See the Global Functions table below for more detail.
If you use the Expert View in the Expression Builder, you can also access a list of the global functions by typing Ctrl+Space.
User Functions
Function(parameters) | Description |
---|---|
attributeContains(String IAttrName, String IAttrValue) |
Checks whether, for the current user, the specified attribute contains the specified value. Return type = boolean |
getAttribute(String IAttrName) |
Gets the value of an attribute for the user. The attributes are any that belong to the user's record stored in the Resource Management LDAP repository. Return type = string |
getCompany() |
Returns the company number of the user. The function gets the company from the company attribute of the user's DataSource_EMPLOYEE agent identity. (The data source is the data area or data ID the user is currently in.) Return type = string |
getCustomerGroup() |
Returns the customer group the user belongs to. The function gets the customer group from the customer group attribute of the user's DataSource_CUSTOMER agent identity. (The data source is the data area or data ID the user is currently in.) Return type = string |
getCustomerId() |
Returns the customer ID of the user. The function gets the customer from the customer attribute of the user's DataSource_CUSTOMER agent identity. (The data source is the data area or data ID the user is currently in.) Return type = string |
getEmployeeId() |
Returns the employee number of the user. The function gets the employee number from the employee attribute of the user's DataSource_EMPLOYEE agent identity. (The data source is the data area or data ID the user is currently in.) Return type = string |
getHostServiceId() |
Returns the user name (UNIX or IBM i) or domain user name (Windows) associated with the current user's RMId through the identity for the host machine OS service. Return type = string |
getRDId() |
Returns the Resource Management ID (RMId) of the user. Return type = string |
getRequesterId() |
Returns the Requester ID of the user. The function gets the requester ID from the requester attribute of the user's DataSource_REQUESTER agent identity. (The data source is the data area or data ID the user is currently in.) Return type = string |
getUserName() |
Returns the OS user name (UNIX/IBM i) or the NT ID (Windows). Return type = string |
getVendorGroup() |
Returns the vendor group of the user. The function gets the vendor group from the vendor group attribute of the user's DataSource_VENDOR agent identity. (The data source is the data area or data ID the user is currently in.) Return type = string |
getVendorId() |
Returns the vendor ID of the user. The function gets the vendor ID from the vendor attribute of the user's DataSource_VENDOR agent identity. (The data source is the data area or data ID the user is currently in.) Return type = string |
isAboveInStruct(String IStruct, String IFromId) |
Checks if user is above another resource in a given structure. Return type = boolean |
isAttributeInRange(String IAttrName, String IAttrValue) |
Checks if, for the current user, the value for an attribute is within a range. To specify a range, use commas to separate numbers and hyphens to indicate a contiguous range. Example: 1,3,7,9-22 indicates that the following numbers will be included: 1,3,7 and then 9 through 22 inclusive. Return type = boolean |
isCustomer() |
Returns TRUE if the user is a customer. The function considers the current user to be a customer if the user's RMId maps to a DataSource_CUSTOMER agent identity where the customer attribute has a value. Return type = boolean |
isEmployee() |
Returns TRUE if the user is an employee. The function considers the current user to be an employee if the user's RMId maps to a DataSource_EMPLOYEE agent identity where the employee attribute has a value. Return type = boolean |
isInChainOfCmd(String RDId) |
Checks if user is above in the chain of command of a given resource. Return type = boolean |
isInChainOfCmdOfEmpInHR(String company,String employee) |
Checks if the user is in the reporting structure chain of command of an employee, based on the company and employee number. The reporting structure is the hierarchy of direct reports based on the employee and supervisor setup in Human Resources. A user is considered to be in the reporting structure chain of command of a supervisor if the user is a direct report of the supervisor or if the user is anywhere in the chain of supervisor/employee relationships below the supervisor. Return type = boolean |
isMemberOf(String groupName) |
Checks if user is a member of a given group. Return type = boolean |
isRequester() |
Checks if the user is a requester. The function considers the current user to be a requester if the user's RMId maps to a DataSource_REQUESTER agent identity where the requester attribute has a value. Return type = boolean |
isSupervisorOf(String RDId) |
Checks if user is the immediate supervisor of a given resource. To determine whether a user is the supervisor of another user, this function looks at the structure designated as the other user's primary structure. You designate a user's primary structure in the Resource Management user record. Return type = boolean |
isSupervisorOfEmpInHR(String company, String employee) |
Checks if user is the immediate supervisor of an employee, based on the company and employee number, and based on the setup in Human Resources for employees and supervisors, including Employee (HR11.1) and Supervisor (HR07.1). Return type = boolean |
isVendor() |
Checks if the user is a vendor. The function considers the current user to be a vendor if the user's RMId maps to a DataSource_VENDOR agent identity where the vendor attribute has a value. Return type = boolean |
Global Functions
Global functions are divided into the following categories:
-
utils: Primarily string and number manipulation functions for converting parameters.
-
Structure: Functions that are used in rules that reference structures.
-
Identities: Functions that perform validations against identity data.
-
Elm/ElmGrp: Functions that make use of elements and element groups.
Function(parameters) | Description |
---|---|
utils | |
alphaEquals(String value, String target) |
Checks whether the specified alphanumeric string is equal to the target string. Leading or trailing spaces are ignored. Return type = boolean |
concat(String inputstr1, String inputstr2) |
Joins two strings together. Return type = string |
dateDiff(date,date2) |
Takes two dates as input and performs a calculation to determine the difference (number of days between) the two dates. Returns a positive number if the first number is later than the second, a negative number if the if the second number is later than the first, or zero (0) if the two dates are the same. Parameters: Two dates (date1 and date2) separated by commas and enclosed in single quotes. Must be input in yyyyMMdd format. Syntax: dateDiff('date1','date2') Examples: dateDiff('20051130','20051123') = 7 dateDiff('20051123','20051127') = -4 dateDiff('20051123','20051123') = 0 Return type = value |
dateFormat(Date,CurFormat,OutputFormat) |
Reformats a date to a specified date format. Parameters: Date, format that the date is currently, new format that you want the date to be in with each parameter separated by commas and enclosed in quotes Syntax:
Examples: dateFormat('11/23/2005','MM/dd/yyy','yyyyMMdd') = 20051123 dateFormat('2005112005','yyyyMMdd','MM/dd/yyyy') = 11/23/2005 Return type = date string |
getDBField(String tablename, String fieldName, String Key1Value . . . String KeynValue) |
Establishes a database connection and returns the value of a field, based on the table (file) name, field name, and key values passed as parameters. The table must exist in the current data source. Return type = string |
getDBFieldbyIdx(String tablename, String fieldName, String Key1Value . . . String idxName) |
Establishes a database connection and returns the value of a field, based on the table (file) name, field name, and key values passed as parameters. It differs from getDBField in that you can pass the actual name of the index that you want. The table must exist in the current data source. Return type = string |
getSystemDate(format) |
Returns the system date in the specified date format. Parameter: Date format Examples: getSystemDate('yyyyMMdd') = 20051123 getSystemDate('MM/dd/yyyy') = 11/23/2005 getSystemDate('MM/dd/yy') = 11/23/2005 (notice that the year is always returned as four digits) getSystemDate('MM-dd-yyyy') = 11-23-2005 getSystemDate('MM dd,yyyy') = Nov 23, 2005 Return type = date string |
getSystemTime() |
Returns the system time in the format hh:mm:ss. Hours must be between 0 and 23, minutes and seconds must be between 00 and 59. Return type = date string |
instr(String SearchString, String lookfor) |
Checks whether a given string (lookfor) is within another string (SearchString). Return type = boolean |
isAlphaInRange(String value, String low, String high) |
Checks whether the specified value is greater than or equal to the low value and less than or equal to the high value. The case of the string is ignored. Return type = boolean |
isNumInRange(String value, int low, int high) |
Checks whether the specified value is greater than or equal to the low value and less than or equal to the high value. Return type = boolean |
lztrim(String numstr) |
Trims leading zeros from a string representing a number. You should use this function when you compare a numeric value stored in the LDAP repository to a numeric value from the Lawson application system. The numbers in the Lawson system will have leading zeroes but the LDAP values will not. Return type = string |
match(value,RegExpression) |
Compares two strings (Value and RegExpression) to determine if "Value" matches "Regular Expression." Return type = string Any string that can be represented in the Regular Expression language is valid. More details, including examples, are in another section. Knowledge of the Regular Expression language is a prerequisite for using this function. Expression Builder provides a simpler function, WildCharMatch() that provides some of the same functionality as match(). |
numEquals(String value, int target) |
Checks whether the specified numerical value is equal to the target value. Return type = boolean |
strtoNum(str) | Forms store all data, including numeric data, as strings. This function transforms numeric strings into numeric data that can be used in comparisons and other calculations. |
subString(String inputstr1, String start, int length) |
Returns the specified portion (length) of a string (inputstr1), starting after the specified "start" string. Return type = string |
trim(String str) |
Trims leading and trailing spaces from a string. Return type = string |
WildCharMatch(value,WildChars) |
Compares two strings (value and WildChars) to determine if "value" matches "WildChars." Retrieves alphanumeric data only. Return type = string More details, including usage examples, are in another section. |
Structure | |
attributeContains(String RMID, String attrName, String attrVal) |
Checks whether, for the specified user, the specified attribute contains the specified value. Return type = boolean |
getAttribute(String RMID, String attrName) |
Returns the value of the specified attribute for the user with the specified RMId. Return type = string |
getStructNodeAbove (String structname, String startwith) |
Returns the level node above the specified level node in a Resource Management structure. Return type = string |
isMemberOf(String groupName, String lookfor) |
Checks whether the RMId specified in the lookfor string is a member of the specified group. Return type = boolean |
isStructNodeAbove(String structname, String startwith, String lookfor) |
Checks whether one level node (lookfor) is above another level node (startwith) in a specified Resource Management structure. Return type = boolean |
isStructNodeTitleAbove(String structname, String startwith, String lookfor) |
Checks whether a node with the specified title (lookfor) is above another level node (startwith) in a specified Resource Management structure. Return type = boolean |
getIdentityAttribute(String serviceName, String attrName, String rmId) |
Returns the value of an identity attribute for a user with the specified RMId for a specified service. Return type = string |
Identities | |
getAgentAttribute(String dataSrc, String agentType, String attrName, String rmId) |
Returns the value of an agent identity attribute. The parameters supply the data source, the agent type (for example, EMPLOYEE), the attribute name (for example, Company), and the RMId of the user whose agent attribute you want to retrieve. Return type = string |
getHostServiceName() |
Gets the symbolic name of the OS service running Lawson. Return type = string |
getIdFromCustomer(String cust_group, String customer) |
Returns the RMId based on the customer group and customer. The function searches through identities set up for the DataSource_CUSTOMER agent for one with customer group and customer values that match the specified values, and then returns the RMId that identity is mapped to. Return type = string |
getIdFromEmpNbr(String company,String empNbr) |
Returns the RMId based on the company and employee number. The function searches through identities set up for the DataSource_EMPLOYEE agent for one with company and employee values that match the specified values, and then returns the RMId that identity is mapped to. Return type = string |
getIdFromRequester(String requester) |
Returns the RMId based on the requester. The function searches through identities set up for the DataSource_REQUESTER agent for one with requester value that matches the specified value, and then returns the RMId that identity is mapped to. Return type = string |
getIdFromVendor(String vendor_group, String vendor) |
Returns the RMId based on the vendor group and vendor. The function searches through identities set up for the DataSource_VENDOR agent for one with vendor group and vendor values that match the specified values, and then returns the RMId that identity is mapped to. Return type = string |
getRMIdForEnvOSId(String envOSId) | Returns the RMId based on the environment OS ID. |
hasIdentityForService(String serviceName, String rmId) |
Checks whether the user with the specified RMId has an identity for the specified service. Return type = boolean |
isAgentOfType(String dataSrc, String agentType, String rmId |
Checks whether a user with the specified RMId has an agent identity for the specified data source and agent type. Return type = boolean |
Elm/ElmGrp (Element and Element Group Functions) | |
isElementAccessible(String elementName, String Action, String ElementValue, String SystemCode) |
Checks whether the user has access to an element for a specified action and value. Return type = boolean |
isElementGrpAccessible('ElemGrpName', String Action, String ELEMENT1_Value...String ELEMENTn_Value where "ElemGrpName" is "HREMP" or "PROCLEVEL", String SystemCode) |
Checks whether the user has access to a form based on the values for the element group's elements and the system code. For example, for the PROCLEVEL element group, the elements are COMPANY and PROCESS-LEVEL. You can then write an expression that determines whether a user has access to a form only when the form is in the HR system and the data is for company 1234 and process level Admin. You can also write more complicated expressions that check for a range of values for the elements. There is a separate isElementGrpAccessible() function for each element group. Return type = boolean |