How to obtain data from multiple Columns in data table

Hello all,

I have a project where I need to use several columns from the data table. Depending on what direction or steps I need to take is what column I will be using.

My process is as follows:

Using a read range = Process_DT
Using a For Each Row
CurrentRow in Process_DT

here is an example of what excel file

|Column1|Column2|Column3|Column4|Column5|Column6|
|123 |asb |string2 |string3 |string4 |string5 |

My question is, rather than having multiple assign to bring in the columns names i.e "CurrentRow(“Column1”).ToString and so on. What is another approach I could use to avoid having too many variables?

I appreciate any feedback

Hi @arturo.ayala

You can use Linq expressions to avoid multiple assign variables

Regards

You don’t create variables for the values. Just use CurrentRow(“column name”).ToString wherever you want to use one of the values.

Well in this current project I need to use them accross multiple workflows, outside the current for each row in data table

Not sure how that would be achieved?

Not too familiar with using Linq, however I will search some info online

What do you mean by “across multiple workflows”?

Anyway, a datatable is a variable. You can pass the whole datatable to another workflow. Or if you’re inside a For Each Row you can pass CurrentRow since it’s also a variable.

LINQ is not a solution for what you’re asking.

my 1st workflow (xaml) has the read range and the for each activity,

then I invoke another xaml to execute the process based on the action I need to take

screen shot

You can just pass CurrentRow in the arguments for Invoke Workflow. Then CurrentRow(“Column Name”).ToString will work in the sub-workflow.

ok… so If I am passing current row, will I need to assign “CurrentRow” as an argument? and pass it to the other workflows?
or how would I pass it

for some reason the site is not allowing me to paste any screen shots my apologies

Yes you pass it the same way you would pass any variable. The datatype of the argument should be DataRow.

This is exactly what I needed and I learned something new. Thank you again @Postwick

1 Like

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