Question:
How can I fill a Table column using a loop in Workflow?
Answer:
You have a list of Users in one column of a Table Field but need to dynamically look up and fill in their Company Name. This data is already held in Data Records stored in your Personnel File Cabinet, but you need an automatic way to fill the Table Column. This process is very similar to the well-known Keyword loop, but this will explain how to work with Table Rows.
How can I fill a Table column using a loop in Workflow?
Answer:
You have a list of Users in one column of a Table Field but need to dynamically look up and fill in their Company Name. This data is already held in Data Records stored in your Personnel File Cabinet, but you need an automatic way to fill the Table Column. This process is very similar to the well-known Keyword loop, but this will explain how to work with Table Rows.
- Create the following four Global Variables:
- (Numeric) counter
- (Text) lookupCompany
- (Numeric) rowCount
- (Text) tableName
- Add an Assign Data step to set our two Counters to represent the following;
Workflow global variable = rowCount = Airthmetic expression = DW_TABLE[FIELD_NAME].Count()
Workflow global variable = counter = Fixed entry = 0
The expression used for the rowCount variable will replace the Table and Column name with your own from your system.
- Add a Condition to compare our Counter to the total number of Rows. To achieve this, use the following expression for the Condition section;
GV_counter >= GV_rowCount - Add another Assign Data step to the “Loop” node of this Condition. Define the Assign Data step as follows;
Workflow global variable = tableName = Airthmetic expression = DW_TABLE[FIELD_NAME](GV_counter)
Workflow global variable = lookupCompany = File cabinet = SELECT[DW_Company]
Workflow global variable = rowCount = Airthmetic expression =GV_counter + 1
Index table - Single column= Table - Company = Arithmetic expression = GV_lookupCompany
Explanation of Arithmetic Expressions and Data assignments
tableName - DW_TABLE[FIELD_NAME](GV_counter)
This will pull the value from our Name column into a GV. We’ll use our Counter GV to specify which row we’d like to pull.
lookupCompany
This is a File Cabinet lookup that’s using the value we just pulled and trying to find a Data Record with a matching name. If it finds one, it will pull the Company value that’s associated with that user.
- counter
It's very important that this line is above the Table Fill assignment. Here we will add 1 to our Counter so that it can pull the next row of the table when it loops again.
Table – Company
This is the Column we want to fill in our Table. We’ll use the value we just pulled into the GV_lookupCompany above, and we’ll need to use the Filter to specify which row it’s going into.
5. If configured correctly, this workflow will pull each name from the Name column, do a File Cabinet lookup to find which company they belong to, and write the value into the Company column:
KBA applicable for both Cloud and On-premise Organizations