cancel
Showing results for 
Search instead for 
Did you mean: 

Updating my Current Row index of colletion

Rajani_KantSha1
Level 2

Hi 

I am running code stage to update the value of collection but after operation my Current index of the row of the output is getting reset to 1 of 3911, but my input collection had 2 of 3911. How to preserve the current row index value in Output Row. Please help this is something weired
25789.png



------------------------------
Rajani Kant Sharma RPA Developer(Blue Prism & UiPath)
RPA Developer(Blue Prism & UiPath Developer)
TietoEVRY
Asia/Kolkata
------------------------------
5 REPLIES 5

Hello,

I guess you can achieve this by native collection utility. Is there a reason you are using a custom code stage here?

  1. Loop on Input collection
  2. Create a counter
  3. Update output collection using the counter/index number using the below action25774.png

Flow

25775.png



------------------------------
If I was of assistance, please vote for it to be the "Best Answer".

Thanks & Regards,
Tejaskumar Darji
Sr. Consultant-Technical Lead
------------------------------

Hello,

Here I am using a loop in a collection inside that I am calling Code stage so that it can filter some value in the same collection and update the column field value in the same collection and return the same updated collection.



------------------------------
Rajani Kant Sharma RPA Developer(Blue Prism & UiPath)
RPA Developer(Blue Prism & UiPath Developer)
TietoEVRY
Asia/Kolkata
------------------------------

Okay understood. In that case, also the use of the index counter and Set collection field action can be used to achieve the same.

Although it will not show you row nos changing for output collection in studio UI but the values will be actually updated to the specific row only in the output collection.

Please try it out once.



------------------------------
If I was of assistance, please vote for it to be the "Best Answer".

Thanks & Regards,
Tejaskumar Darji
Sr. Consultant-Technical Lead
------------------------------

No Actually my requirement is different. Thanks for the suggestion. Could you please tell me is there any way to Preserve the Active Row Index or Get/Set Active Row Index when we do something on Input Collection data and store it in Output Collection data.

When we are doing some operation on Input Collection and store the output in Output Collection the Active Row Index is reset to always 1 which lead to infinite loop



------------------------------
Rajani Kant Sharma RPA Developer(Blue Prism & UiPath)
RPA Developer(Blue Prism & UiPath Developer)
TietoEVRY
Asia/Kolkata
------------------------------

You can preserve the index using a counter only. See the above workflow snapshot that I attached earlier. You need to use counter+1 within the loop and it will take care of your index.

Now use the same counter as an index to update the value in the Output collection. I added a snapshot for the action that you need to use.

You can check the below thread also where the same solution is mentioned.

https://community.blueprism.com/communities/community-home/digestviewer/viewthread?GroupId=145&MessageKey=af26ad91-b697-46ea-bf32-7bd8658bf3b7&CommunityKey=3743dbaa-6766-4a4d-b7ed-9a98b6b1dd01&tab=dig...

I request you to try it out using dummy data and you will understand the concept, it is very simple.



------------------------------
If I was of assistance, please vote for it to be the "Best Answer".

Thanks & Regards,
Tejaskumar Darji
Sr. Consultant-Technical Lead
------------------------------