At first this seemed to me like a basic parse, but somehow I couldn’t crack it, any help would be greatly appreciated.
I have 3 collection variables.
Quantity - 34; 45;
Description - myRecord1; myRecord2;
Price - 599;899;
I want to build a string like this using Nintex workflow.
Final Text / Desired Output - #34, myRecord1, $599 \n\r #45, myRecord2, $899
How do I achieve this using Nintex workflow?
Best answer by Garrett
Hi @CherryDev
Does all the collection variables have the same count of items? Yes
Use Loop instead of for-each Loop. Use Get Items from Collection and specify the Index. Nintex uses 0-based Index. first item is at index 0. last item is at index n-1 (where n is the total items in the collection Use Build String to build the string
PSEUDOCODE
Count Items in collection (any one) → int_count Set var → int_index equals 0 Loop int_count times Get item from collection (Quantity) at index int_index → txt_quantity Get item from collection (Description) at index int_index → txt_desc Get item from collection (Price) at index int_index → txt_price Build String → txt_string = txt_string + txt_quantity + txt_desc + txt_price + “\n\r” //Append new row to the variable txt_string Log to History → txt_string //verify value Calc: int_index = int_index + 1 //Important! → increment the index by 1 Log to History → txt_string //verify FINAL value
Hope this give you a rough idea for the implementation
Does all the collection variables have the same count of items? Yes
Use Loop instead of for-each Loop. Use Get Items from Collection and specify the Index. Nintex uses 0-based Index. first item is at index 0. last item is at index n-1 (where n is the total items in the collection Use Build String to build the string
PSEUDOCODE
Count Items in collection (any one) → int_count Set var → int_index equals 0 Loop int_count times Get item from collection (Quantity) at index int_index → txt_quantity Get item from collection (Description) at index int_index → txt_desc Get item from collection (Price) at index int_index → txt_price Build String → txt_string = txt_string + txt_quantity + txt_desc + txt_price + “\n\r” //Append new row to the variable txt_string Log to History → txt_string //verify value Calc: int_index = int_index + 1 //Important! → increment the index by 1 Log to History → txt_string //verify FINAL value
Hope this give you a rough idea for the implementation