I have a pulled out data from a repeating section using xml query. Inside the loop query xml creates variables for Item, Cost, Qty, Total. Obviously in the second iteration of the loop, the variables are overwriting with new values.. So I created a dictionary variable outside the loop, then inside the loop again I stored the variables into the dictionary variable. This still doesn't work, I still only get the last items from the loop stored in the variable.
1. How can I 'concatenate' this data to a single variable, and more importantly, how can I format it also so that I can use it in an email?
Please note: I am using workflow for office365 with workgroup licence, so please be aware that not all the actions/features that are available on-prem are available to me in O365, so please try answer accordingly.
Solved! Go to Solution.
Sounds like a common use of form data and a repeating section. You should be using a dictionary per value you are retrieving. So if the repeating section has 4 values (Item, Cost, Qty, Total) as values, then you need 4 dictionaries. In the loop, add an output in the Query XML action for each vale and store the result in 4 single line of text variables. Then the next action should be doing something with those values before you loop and check the next row. If you require them to be stored in a dictionary, then add the Cost variable's value into the Cost dictionary, Qty variable in to Qty dictionary and so forth. If you do this correctly then you will have 4 full dictionaries.
Things to note:
If you need to print out the entire row (Item, Cost, Qty, Total) info an email, then build a string. You can do this in two ways.
Hi Andrew, a big thank you to you for this information, and for your reply. This has truly helped me further but has not yet got me over the line.
I don't have a "Build String" action in 365, however technically I don't *think* I need a specific action for that, as I can still join variables together using "Set Variable" for example..
I am still confused though with your first paragraph. The Query XML action requires me to set an output variable, which I do. I am not sure where the dictionary variable needs to be set, and why if I already have the value from the Query XML action. Why do I need to set the same value into another dictionary variable, if I already have it in a text variable from the output of the Query XML? Or am I misreading you?
Secondly, if I was sending an email INSIDE each loop, it would not be a problem, however I am not doing that. I need to first get ALL of the rows from the repeating section and have each row 'stored' so that I can use them OUTSIDE of the loop later to assign a using the rows as part of the description and also sending an email with the items from the repeating section included in an email.
Somehow I actually think what you have said above IS actually, still correct, the problem is just a limit in my understanding that I cannot get past yet..
So please help me again
It depends on how you want your data. If you want the Cost variable to have "Cost1 Cost2 Cost3", or have a dictionary variable with Row1 = "Item1 Cost1 Qty1 Total1", Row2 = "Item2 Cost2 Qty2 Total2"
You won't need a dictionary if you use the former in a method i explained earlier. But if you want to save the values as rows in the repeating section, then you need a dictionary.
I figured you were only trying to send one email, so the use of a dictionary saving the rows seemed most logical.
It's up to you, either way. You can concatenate the values as described into a single variable per field, or make them per row. If you do not concatenate into a single variable you can use 4 dictionaries instead. If you want them by row, then concatenate into a single variable and then add to a single dictionary. There are probably 3 or 4 ways of coming to the same outcome.
Hi Andrew this is what I have tried now. I have saved all of my values into separate stings. Before the end of the loop I use "Set Workflow Variable" to create a new text variable and attempt to concatenate my variables (image). I believe this is a copy of your a = a + b, so now a == ab example.
I created the variable "AssetString", then have used that as the first value in the value field, and have added my other asset items variables also.
This results in a never ending loop.
Have I still done something wrong here?
Where do you retrieve the count of items in the Form XML? You need to use that index to compare to an incrementing number variable during the loop to know when to exit the loop. It looks like I didn't post a url that I commonly review for Parsing Repeating Section, Nintex Forms/Workflow - Parsing Repeating Section Data - Vadim Tabakman
Hopefully it can provide more information into this area as it includes the UDA that finds this count.
I have counted and looped correctly. The problem is with the a=a+b. It seems that with Nintex365 it does not like a variable to be assigned to itself.
Thank you for your time | Andrew Huddleston | Hillsong church | +61297753601