How to separate row with specific value from datatable and then store the column value of extracted row to a variable


As the title says, i have a bit of problem in extracting value. I have this datatable with 3 columns. Lets says the columns are name, id and status. The status has 2 possible value which is succeed or error. I want to get all the error row and extract the column name, after that i want to store the column names into a list/array variable. I have tried using foreach row and an if activity. I’m able to get the name value of the rows, but i can’t assign it to a variable without it changing every iteration.
I want to use the list variable to write body of an email. Can i do that without generating new datatable and instead use an array/list to store the value? and can someone gives me direction to do it?

Thank you for the help!


For getting the Error row only then you can use Filter Datatable activity

Write as status= “error” output to a tempdatatableVariable

After that you can use For Each Row activity and give the tempDatatableVariable

Inside the For Each row you can create a variables like name = row(“name”).ToString

so you can include name so that it will create your html email body

Hope this may help you


Thank you for the reply @Srini84 ! i think i understand most of it, i’m still a bit confused at how to write the name into email body, can you give me an example of doing it with smtp activities? Thank you!


Check below link for your reference

Hope this may help you


@Srini84 how about if i have a couple row and the row count is different each input data? for example :
on the first input data it has 3 error and on the second input data it has 5 error.
How should i do it? i want the format to be like this


you have an error at
acc name 1 | error status
acc name 2 | error status
acc name 3 | error status

my question is how to store the names into the subject dynamically(?) or can i just write the datatable that has been filtered to the body instead?


Is it really required to put the names into subject?

This is not a good practice, today you have 5, maybe it might grow to 50 then it is not good to put all into subject

Instead keep that into the Email body

Hope this will help you


ah sorry i mean the body of the email and not the subject. i want to write the names and status to body email. can you tell me if my logic is right?

So at first i input the data, convert the data to a datatable, filter the datatable and get the output datatable, now using for each i want to store the value of output datatable rows into a list variable, after that i would insert the list variable into the body of email.

my main question is, how to store the value from each row to a list variable? also is it possible to just assign list variable to a body of email?