Value of type ‘CurrentRowQuickHandle’ cannot be converted to ‘DataRow’

Basic Question

Using the Modern experience, how do I assign the “For each” item, CurrentRow, in a For Each Excel Loop activity to a variable so the row data can be passed to another sequence?

Background and Details

I am writing a bot to
• Read an Excel file
• For each row in the file, check to see if processing is needed
• If processing is needed, pass data to another sequence, SequenceB.
• If processing is not needed, go to next row.

I am using the Modern experience, and everything works fine until I need to pass the data to the other sequence.

• Excel Process Scope – works as expected
• Use Excel File – works as expected
• For Each Excel Row – works as expected
• ElseIF – works as expected

To pass the data to SequenceB, I need a variable in Main to match the argument in SequenceB. I created one, DR_Current, and tried to Assign the CurrentRow from the loop to it. However, I get a compiler error. “Value of type ‘CurrentRowQuickHandle’ cannot be converted to ‘DataRow’.

Any help would be greatly appreciated!

Screen capture of bot
UiPathBot

Screen capture of variable creation in Main
UiPathVariable

Screen capture of error message

UiPathError

Why are you trying to assign CurrentRow to the variable DR_Current? CurrentRow IS a variable. What are you trying to achieve?

Hey

Try the following

As we are using modern it should be the same variable type and then you can use as normal datarow variable

Regards!

When I try to invoke SequenceB, I get the same compiler error.

InvokeError

I was trying to save the CurrentRow to a variable that the invoke activity would accept.

Hi @cmiles ,

Could you Check by assigning the value in the below way :

DR_Current = CurrentRow.ToDataTable.Rows(0)

Let us know if this does not work.

Why are you trying to loop over the Invoke Workflow instead of just putting the BillNeeded steps right here in the Do, or instead of doing the loop inside BillNeeded.xaml?

Thank you Fernando!!!

I just needed the correct variable type - CurrentRowQuickhandle. I didn’t realize this was a variable type and thought it was just a description.

I set the argument in SequenceB to CurrentRowQuickhandle and everything worked beautifully with no need for the Assign activity.

1 Like

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