31-08-23 12:30 PM
Hi,
I've a collection that has certain fields, I've a field name in a text data item, now while looping through the collection I want to update certain field data in-order to do this I should access the field name from the data item I have, how should I use the field name to fetch the data if I use [Collection.[Field Name]] it's giving me an error.
01-09-23 04:45 PM
Hi Babjee Vangipurapu,
I faced similar challenge in the past to work around this issue, I used code stage to manipulate the data instead of using decision or calculation stage....
Waiting to see if some one have different approach.
03-09-23 07:33 AM
Hi Harish,
Thank you for the reply can you please send me the code that you've written I'll see if I can use it from my end.
Tagging other active community people @Tejaskumar_Darji, @Mukesh Kumar, @Emerson Ferreira, @Vipul Tiwari please let us know if you've any other approach
04-09-23 05:09 AM
HI Babjee Vangipurapu,
That code might not be available for me, but I would try to recreate and share it with you. t will be most likely some time after tuesday.
Thanks,
Harish
04-09-23 08:07 AM
Hello Babjee Vangipurapu
You can use Utility Collection Get Collection Fields and Read Collection Field action to achieve this instead of a calc stage where it does not allow to use field name from a data item.
You will have to know the row index somehow to get this work.
04-09-23 08:13 AM
Thanks for the answer, I'm not trying to read the collection data instead trying to update the value of a field while looping the collection.
04-09-23 09:09 AM
Oh okay that also will work with Set Collection Field action using the same approach.
05-09-23 01:28 PM
Sorry for the late response.
Here is the code and steps
I have used Coll_1 as Input collection and FieldName as text and passed these two values and updated collection fieldName "Field2" by using "FieldName" data item.
1)
2)
3)
4) Code:
foreach (DataRow row1 in Coll_1.Rows){
row1[FieldName] = "This is test";
}
Coll_2= Coll_1;
5)
Hope this helps.