Cannot modify the data type in Foreach activity

In the new update, there is no option for changing the datatype. Default type is object. In my requirementI need to change it.

Hey! Welcome to community!

Which version of studio are you using?

Regards,
NaNi

2023.4.1 version community edition

Studio seems to be able to detect correct type automatically, at least in my workflows. Can you show your ForEach activity and tell us which type you need?

Here the variable is object datatype.

Hi @vishnugopal

Try giving “currentitem.tostring” in the Output Datatable Activity.since currentitem is object datatype converting that into string might solve the error.

Hope it helps!!

Regards,

Hi @Parvathy,

The Output data table activity is used to just see the values in the table and its input type is Data table. My doubt is how to modify the datatype in for each activity. In earlier versions of UiPath, we could modify that. Is there any alternative method?

Hey!

Can you share us the for each activity properties.

I think the type argument will detect based on the input we give.

Regards,
NaNi

Hi @vishnugopal ,

Could you try to use the below Expression in the For Each and check if the currentItem automatically converts to Datatable :

DataSet.Tables.Cast(Of Datatable)

Also, Not a very Good Idea to name Dataset type variable as DataSet.

1 Like

Please check this thread: How to iterate datatables from a dataset using foreach? - Help / Studio - UiPath Community Forum - https://forum.uipath.com/

Hello @vishnugopal , Please check below screenshot code is shared on how to change the datatype in data table

Hi @supermanPunch,

This works for me.
Thanks for the suggestion. I was created this for learning purpose. Will change the variable name while doing the live projects.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.