What are the row and rowset variables used in autocomplete rules?
Hello, my name is Steve. In this video, I’ll explain row and rowset variables used in autocomplete rules.
To create a rule, you typically would start with the business object that contains the field you want to default or validate. However, in order to sample values of fields in other related lookup, parent, or child type objects, you need to declare a row or rowset variable to gain access. The Row and Row collection variables are considered to be special variables that allow you to navigate from the current business objects to related business objects to fetch criteria that is needed for a rule. To create a Rowset variable, Row collection is used.
With Row and Rowset variables, you can:
-
Fetch values in fields prior to the current flow.
-
Fetch values of fields that exist in the database for objects that aren't part of the current flow.
For example, if you navigate to Worker Assignment from the Change Salary flow, you will get values of fields in Worker Assignment that exist in the database. Another example is when you fetch values from an object that are lookup type entities. They too will fetch previously set up values of fields in the lookup.
The row variable has two variants:
-
Variant 1, uses a row variable when there's a one-to-one relationship between the current and related object from which you are fetching a value. A one-to-one relationship indicates that the related object is a status, category, or lookup code. After defining a row variable, on the right side of the operand you will see only those values or lookup codes as available values.
-
Variant 2, uses a row variable when there's a one-to-one relationship between the object you're operating on and an entirely different object, such as a parent object, or an object from another functional area. Or when there's a functional one-to-many relationship with the current object and the related object that has the values you want, and you're only interested in fetching the current applicable row.
For example, when you're traversing from the Worker Assignment object to the Primary Work Relationship object, you're only interested in the current primary work relationship. When you need to fetch the current applicable row of a related object, you define a row variable. Then you specify the Get First Row on the right hand side of the equation.
Use the rowset variable when there's a one-to-many relationship between the object you're operating on and a related object. For example, you would use a rowset variable when you're traversing from the Person object to the Person Passport or Person Citizenship object, and you want to scan all possible rows and their values for that object. One reason you would want to scan all possible rows is because a person can have multiple passports or citizenships. By scanning each row you could perform business logic using each row as you scanned it, before moving on to the next relevant row.
The information you gather from row and rowset variables can be both old and new values of the same field. For example, when you navigate from Salary to Worker Assignment, you get field values in the Worker Assignment object that correspond to values just entered in the preceding section of the current flow. However, prior to starting the current flow, these values won’t be in the Worker Assignment object.
For field values in the current object, any changes made by the user are still in process as the transaction has not yet been submitted. Similarly, any fields of related objects you fetch are also in process and not yet submitted.
You can compare the in process values, which have not been submitted, to the existing values that are in the object. For example, if you are changing an employee's salary, before submitting the change you can compare the proposed new salary, to the existing old salary.
A row collection looping block is used with the rowset variable. All related records of an object that have a one-to-many relationship with either the current business object or related object are ran by the block. Until the last record is reached, the execution inside the looping block will continue. A best practice is to avoid defining new variables within a looping block. It should be noted that there's no way to stop execution of a looping block prior to the last record of the row collection. However, you can use a Boolean variable to control the matching condition inside the loop and sample the variable state after exit of the loop to proceed with your logic.
For example, let's say you're creating a rule to validate that a Brazilian employee has at least one national identifier that is a General Registry number. You could define a Boolean variable named NID_Type and set it to false. Then you could use a looping block to iterate through the person's national identifiers. If the looping block logic identifies a record that is a General Registry number, the Boolean would be set to true. That value would then be used to determine the subsequent outcome of the rule.
Here is a rule for the Worker Assignment business object. Only the Job ID is stored for this object, so a row variable is used to gain access to the related Job object.
You can then retrieve the single value for the field, Medical Checkup Required. This row is variant 1 as it represents a 1-to-1 relationship between the current object, and a status value in a related object.
Here is a rule for the Person business object. This row is a variant 2 and uses the Get first row function. Declaring this function allows you to access fields and attributes from the child business object, Person Legislative Information. You can then fetch the Country Code from the child object.
A person may have multiple national identifiers. For example, they can have both a Social Security Number and a Tax Identification Number. This is a 1-to-many relationship and would use a rowset variable to fetch the rows. You then add the row collection looping block to iterate through the national identifiers.
This concludes the explanation of row and row collection variables used in autocomplete rules.
Thanks for watching.