What is the reference data type?
Reference data type is used to denote a row of a particular list.
For example, if I say I have a reference field of “employee list” and that field has some data assigned to it. This means that the reference field is denoting some row of “employee list”.
When we say data type, It often comes to our mind as a format of data with certain rules and standards. In general programming, we define the datatype of variables and then save the value assigned to it. Likewise for reference data type variables (fields), if there is no data assigned to the field that means it is not denoting any row of the particular list and vice versa.
Reference data type field with data assigned to it -> Denotes a row of the particular list.
Reference data type field with empty value ->Does not denote any row.
Structure of reference data type fields
When we define a reference data type field it requires a list associated with itself and a name.
For example, if I want a reference field of “employee list” I’ll select that list whenever I’ll be defining the reference field. Like all the fields you also need to provide a name for the reference field.
If I have to define one reference field of “employee list”. I’ll write the name of the field as “employee” and select ”employee list” as the associated list.
How to get row data from reference fields
We can get any data of the denoted row of the “employee list” using the “->” operator.
For example “employee list” has multiple columns like employee name, employee no, employee activity status etc. If I want to access the employee name then I can just write an expression like employee(reference field) -> employee name and it will fetch the employee name. If the field is empty then you won’t get any data. (if you are wondering how to assign data to a reference field then I should let you know that part will come later.)
Before learning how to assign data to a reference field we should understand the concept of Row positioning.
Row positioning is clearly defined as the selected row of a list. It is also referred to as the current row of the list in WEM.
Row positioning is dependent on many events which are listed below
Note: If you navigate to a different page using the navigation menu the positioning will be reset which means there will be no row for the current position.
Assignment of reference field
Step 1: Set the row position using above listed events in the “row positioning section”.
Step 2: Select field as assignment node in the flow and then for that node choose “set to current row” option
Eg: let’s say I have a reference field of the employee list named “Emp”. I need to find an employee using employee ID and get the reference and assign it to the reference field “Emp”.
We will take a list action node. Select the “goto first row” action. Apply condition for “goto first row that matches”. The condition will be that the employee ID you want to match should be available in the column of employee ID in the employee table. So we can write something like employee ID field from input = employee ID column of employee table.