Populate control in a specific row (current).


Badge +2

Hi,

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!


10 replies

Userlevel 5
Badge +14

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.

Badge +2

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.

Userlevel 5
Badge +14

assuming airlineTaskID is name of control within repeating section...

then your XPAth should look like

//RepeaterData/Items/Item[{WorkflowVariable:numIndexVar}]/airlineTaskID ‍

in "store result in"  configure a workflow variable where the result of the update action will be saved

Badge +2

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.

Userlevel 5
Badge +14

can you post screenshots how you have configured actions?

Badge +2

sure

Thanks!!

Userlevel 5
Badge +14

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

 

Badge +2

After a long weekend I finally had time and now it's working!

Thanks for all the help!

Userlevel 5
Badge +14

great.

please mark the question answered.

Badge

normally what you are doing is to save the section of repetition an item list of several lines of text and so you work in the workflow. the solution is to modify through the workflow according to the structure of the xml. when you modify the item list with the correct xml with the data you need. the form interprets the xml and will show the data as you require it

Reply