cancel
Showing results for 
Search instead for 
Did you mean: 

Fetch Collection Field Data

Babjee24
Level 7

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.  35840.png

Babjee Vangipurapu
Senior RPA Developer
India
7 REPLIES 7

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.  

-----------------------
If I answered your query. Please mark it as the Best Answer

Harish Mogulluri

Babjee24
Level 7

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 

Babjee Vangipurapu
Senior RPA Developer
India

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

-----------------------
If I answered your query. Please mark it as the Best Answer

Harish Mogulluri

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.

35833.png

Babjee24
Level 7

Hi @Tejaskumar_Darji

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.

Babjee Vangipurapu
Senior RPA Developer
India

Oh okay that also will work with Set Collection Field action using the same approach.

35834.png

Hi Babjee Vangipurapu,

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)  35835.png

35836.png

2) 

35837.png

3) 35838.png

4) Code:

foreach (DataRow row1 in Coll_1.Rows){
        row1[FieldName] = "This is test";
       
        }
  Coll_2=  Coll_1;

5)

35839.png

Hope this helps.

-----------------------
If I answered your query. Please mark it as the Best Answer

Harish Mogulluri