So I have a repeating section with three controls and for every row I create a task (in another list) and the control are the metadata of the new item. This part I was able to do easily but now I need to update the new item ID for each row.
How can I do this?
I've connected the repeating section to a multi line text and in my workflow I run over the XML and for every row I get the control and save it in a variable. I can't find a way to target the specific line that I'm running on and update the idTask control.
thanks for the help!
Solved! Go to Solution.
I run over the XML and for every row I get the control and save it in a variable
I guess you populated a collection variable with Query XML action and then iterate over the collection with for each loop.
so, simply in for each loop action let save current "Index" to a numeric variable and you will have a reference (index) to the current row being processed.
first thank fot the resposne!
That's what I wanted to do but I'm missing the update XML syntax, I have an index variable.
this is my update XML configuration
I guess that I should use de index in XPath - can't figure it out and also don't understand what should I do with
"store result in" option.
Again, thanks for the help.
assuming airlineTaskID is name of control within repeating section...
then your XPAth should look like
in "store result in" configure a workflow variable where the result of the update action will be saved
so I finallly had time to test it and now I get the xml per row
<?xml version="1.0" encoding="utf-8"?><RepeaterData><Version /><Items><Item><airlineTaskID type="System.String">135</airlineTaskID><airlineCreateTask type="System.Boolean">True</airlineCreateTask><airlinecomment type="System.String">ddfdf</airlinecomment><airlineName type="System.String">a</airlineName></Item></Items></RepeaterData>
but I can't find a way to update the controls.
I use update item and "pushed" the result to the multi line text that is connected to repeating section but it only contains the last item, I understand why this is happening but I can't find a way to solve it.
I'd say there're two problem with your update
- you still take as a source XML value of Airline comments list field.
I'm not sure from your screenshots whether update item action is still within the loop or not, but even if it is in a loop due to shaprepoint batching the change is likely not effectively written to the list and so you still make updates to original source data.
you should make all the updates into a workflow variable (updateXMLresult) and just when you're done with all the updates (likely already out of /after the loop) write the result valuee to the list field
- do not increment index variable on your own. it's automatically incremented by a for each loop action. likely you getting out of collection size boundaries resp. tries to update non existing row in a repeating section.
further hint: you do not need to first query for a row from repeating section and then for a field within the row.
with query XML action you can directly address all the values of a given field/column of a repeating section.
the XPath would be just the same as you use to get data from single row, just apply it on whole repeater XML and not on a single line.
note in that case you will not get a single scalar value but rather a result set that you have to store in a collection variable.
I'd recommend you read through this thread. there I explained quite into details how to work with repeating sections