How do you Assign Multiple Variables from a Data Table?

I have an Excel Sheet that I turn into a Data Table that looks like this…


I’m trying to Iterate through the Data Table and if the Error Value is True I want to Add that FileName as a Variable to be used in another process.

What is the best way of doing this?

Create a variable as array of string.

For Each Row in Datatable, and within the loop use an If to check the value of CurrentRow(“Error”).ToString, in the Then block put an “add to collection” activity to add CurrentRow(“FileName”).ToString to the array.

Once the loop completes your array will have a list of the files with an error. You could pass it to another process by writing it to a text file, into an asset, a file in a Storage Bucket, etc.

1 Like


Welcome to forums

Read your excel file using Read Range activity and create a variable for output, Let say it is dt_Data

Now use Filter Datatable activity and put a condition of Error = “TRUE”

This will filter your datatable all rows to TRUE

Now use ForEach row activity to loop into the filtered Datatable
Inside that use Assign activity and write as strFileName = CurrentRow(“FileName”).ToString

strFileName is a variable of type String

Hope this may help you


That won’t work. This will result in only the last filename being stored in the strFileName variable. CurrentRow(“FileName”) should be added to an array/list not to a string variable.

Sorry I’m having trouble following.

So Start with the Exel…
Use, Read Range, and Save it to a Datatable (dt_Data)

Then when trying to use CurrentRow(“Error”).ToString in the If Check I receive this Error…

CurrentRow cannot be used like a method.
“Error” is inaccessible due to its protection level.

When trying to use CurrentRow(“File Name”).ToString in the Add To Collection I get the same Error…
CurrentRow cannot be used like a method.

Am I missing something?


In If condition just put CurrentRow(“Error”).ToString = “TRUE”

In the add collection you can write as below


I get the same Error with CurrentRow(“Error”).ToString = “TRUE”

I receive that message also for this…



Can you share the screenshot of your For Each Row activity what you placed?


Use = not ==

Set TypeArgument to String

Another way to do the If condition:


That’ll convert “True” and “False” strings to actual boolean values.


Mouse over the red ! icons and show us the errors.


Your project seems C#. Can you try as the following?

If condition

CurrentRow["Error"].ToString().ToUpper() =="TRUE"



CurrentRow["File Name"].ToString()


1 Like

Thank you @postwick , @Yoichi , and @Srini84 for all of your help.