cancel
Showing results for 
Search instead for 
Did you mean: 

adjust all fields in column with same parameter (in loop)

Nannevan_der_W1
Level 3
Hi community,

I want to do a very simple action where I put an " ' " in front of every value in a certain column. So let's say I have a columns named ID, which contains values as the following:

ID
1234
2345
3456

I want to adjust the vales in the following way:

ID
'1234
'2345
'3456

I am now looping through the collection and I adjust the value of a row. However, when I save this in the original collection, the counter in the loop is reset to row 1 (because for blueprism it seems that we have a 'new' collection). See attached for the flow. This means that in my current setup I would have to copy each row after processing to a new row. Which mean I would first have to copy to temp collection, and then an append to existing collection action. 

This seems to be A LOT!!! of hassle for an extremely small requirement...... I just want to add an apostrof to each value in a column. Is there anyone with a suggestion on how to do this easily.

Best,
Nanne




------------------------------
Nanne van der Wal
------------------------------
1 BEST ANSWER

Helpful Answers

TimGrassam
Staff
Staff
Hi

If I have understood your requirement correctly, the below should update the collection 'in place'  (Paste into an empty BP Process)  it should look like this:

23711.png


<process name="__selection__Community collection"><stage stageid="a0a61832-648a-4db7-86d6-32edfae7aacf" name="Start" type="Start"><display x="15" y="-105" /><onsuccess>3872c363-1adf-417f-bf93-1cae7821929e</onsuccess></stage><stage stageid="94dd51b1-fa77-47a1-9b98-40d1f15fc372" name="End" type="End"><display x="15" y="120" /></stage><stage stageid="6249d604-d3d9-4393-9a04-73ae2a695fc9" name="Collection" type="Collection"><display x="-105" y="-45" w="90" h="60" /><datatype>collection</datatype><private /><alwaysinit /><collectioninfo><field name="ID" type="text" /></collectioninfo><initialvalue><row><field name="ID" type="text" value="1234" /></row><row><field name="ID" type="text" value="2345" /></row><row><field name="ID" type="text" value="3456" /></row></initialvalue></stage><stage stageid="f228dddc-cdfe-4513-bca1-724ce16c8577" name="Prefix" type="Data"><loginhibit onsuccess="true" /><display x="-90" y="45" w="90" h="60" /><datatype>text</datatype><initialvalue xml:space="preserve">'</initialvalue><private /><alwaysinit /></stage><stage stageid="3872c363-1adf-417f-bf93-1cae7821929e" name="Loop Collection" type="LoopStart"><loginhibit onsuccess="true" /><display x="15" y="-45" /><onsuccess>92b62bb9-0fb2-4ab3-af6c-c8eca6aa296f</onsuccess><groupid>e94aeb6e-8d60-4962-8add-e79cb19fd8da</groupid><looptype>ForEach</looptype><loopdata>Collection</loopdata></stage><stage stageid="a7838465-1711-4814-bce4-eb153baf239e" name="Loop Collection" type="LoopEnd"><loginhibit onsuccess="true" /><display x="15" y="60" /><onsuccess>94dd51b1-fa77-47a1-9b98-40d1f15fc372</onsuccess><groupid>e94aeb6e-8d60-4962-8add-e79cb19fd8da</groupid></stage><stage stageid="92b62bb9-0fb2-4ab3-af6c-c8eca6aa296f" name="Add Prefix" type="Calculation"><loginhibit onsuccess="true" /><display x="15" y="0" /><onsuccess>a7838465-1711-4814-bce4-eb153baf239e</onsuccess><calculation expression="[Prefix] &amp; [Collection.ID]" stage="Collection.ID" /></stage></process>

------------------------------
Tim Grassam
Consulatant
Blue Prism
Europe/London
------------------------------

View answer in original post

7 REPLIES 7

david.l.morris
Level 15
The counter shouldn't be reset. What's in your calculation stage? I would expect to see the expression as [rowcounter]+1 and store into rowcounter.

------------------------------
Dave Morris
Cano Ai
Atlanta, GA
------------------------------

Dave Morris, 3Ci at Southern Company

The calculation stage indeed has a [rowcounter]+1 saved in [rowcounter]. This rowcounter is necessary for the row index input field for set collection field. But the problem is that when I save the updated colleciton in the original collection. The row in the loop is reset to row 1.

So the counter is not reset, it is updated with plus one each time.

I am looking for another way to get a ' for each value. There must be a simpler way

------------------------------
Nanne van der Wal
------------------------------

Hmm, I guess I've never done the loop pattern as you're doing so it hasn't occurred to me that Set Collection Field would reset the loop. You might try removing the Loop stages entirely and using a manually created loop using Read Collection Field and then Set Collection Field. These would take the same rowcounter input.

------------------------------
Dave Morris
Cano Ai
Atlanta, GA
------------------------------

Dave Morris, 3Ci at Southern Company

TimGrassam
Staff
Staff
Hi

If I have understood your requirement correctly, the below should update the collection 'in place'  (Paste into an empty BP Process)  it should look like this:

23711.png


<process name="__selection__Community collection"><stage stageid="a0a61832-648a-4db7-86d6-32edfae7aacf" name="Start" type="Start"><display x="15" y="-105" /><onsuccess>3872c363-1adf-417f-bf93-1cae7821929e</onsuccess></stage><stage stageid="94dd51b1-fa77-47a1-9b98-40d1f15fc372" name="End" type="End"><display x="15" y="120" /></stage><stage stageid="6249d604-d3d9-4393-9a04-73ae2a695fc9" name="Collection" type="Collection"><display x="-105" y="-45" w="90" h="60" /><datatype>collection</datatype><private /><alwaysinit /><collectioninfo><field name="ID" type="text" /></collectioninfo><initialvalue><row><field name="ID" type="text" value="1234" /></row><row><field name="ID" type="text" value="2345" /></row><row><field name="ID" type="text" value="3456" /></row></initialvalue></stage><stage stageid="f228dddc-cdfe-4513-bca1-724ce16c8577" name="Prefix" type="Data"><loginhibit onsuccess="true" /><display x="-90" y="45" w="90" h="60" /><datatype>text</datatype><initialvalue xml:space="preserve">'</initialvalue><private /><alwaysinit /></stage><stage stageid="3872c363-1adf-417f-bf93-1cae7821929e" name="Loop Collection" type="LoopStart"><loginhibit onsuccess="true" /><display x="15" y="-45" /><onsuccess>92b62bb9-0fb2-4ab3-af6c-c8eca6aa296f</onsuccess><groupid>e94aeb6e-8d60-4962-8add-e79cb19fd8da</groupid><looptype>ForEach</looptype><loopdata>Collection</loopdata></stage><stage stageid="a7838465-1711-4814-bce4-eb153baf239e" name="Loop Collection" type="LoopEnd"><loginhibit onsuccess="true" /><display x="15" y="60" /><onsuccess>94dd51b1-fa77-47a1-9b98-40d1f15fc372</onsuccess><groupid>e94aeb6e-8d60-4962-8add-e79cb19fd8da</groupid></stage><stage stageid="92b62bb9-0fb2-4ab3-af6c-c8eca6aa296f" name="Add Prefix" type="Calculation"><loginhibit onsuccess="true" /><display x="15" y="0" /><onsuccess>a7838465-1711-4814-bce4-eb153baf239e</onsuccess><calculation expression="[Prefix] &amp; [Collection.ID]" stage="Collection.ID" /></stage></process>

------------------------------
Tim Grassam
Consulatant
Blue Prism
Europe/London
------------------------------

Hi, Nanne,

the solution is easy instead of calling Set Collection Field you put in calculation stage your formula:
"'"&[seriennummers.Seriennummer] and store it in [seriennummers.Seriennummer]. that's it! nothing else. You don't need any counter.
If you want to conditionally update it put the decision stage before calculation stage and that is it.

Regards,



------------------------------
Zdeněk Kabátek
Head of Professional Services
NEOOPS
http://www.neoops.com/
Europe/Prague
------------------------------

Thank you all for the super fast usefull reactions!!!!

Somehow my line of thought was stuck in thinking I would neet the Set Collection field action to make adjustments. But this is great, and so obvious..........

Thanks all!

------------------------------
Nanne van der Wal
------------------------------

Haha. I literally do this all the time, and I still got stuck on the need for Set Collection Field with you. 😃

------------------------------
Dave Morris
Cano Ai
Atlanta, GA
------------------------------

Dave Morris, 3Ci at Southern Company