05-06-23 09:13 AM
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
06-06-23 06:18 AM
Hello,
I guess you can achieve this by native collection utility. Is there a reason you are using a custom code stage here?
Flow
06-06-23 06:39 AM
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.
06-06-23 07:13 AM
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.
06-06-23 07:37 AM
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
06-06-23 07:49 AM
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.
I request you to try it out using dummy data and you will understand the concept, it is very simple.