How can you pass different DataTables in .rows.Items

I have 2 DataTables
I want to retrieve the first row and first column of each.

This code works, but I would like to interchange the DataTable, depending on an if statement, thus sometime it could be DT_Test and other times it should be DT_Names.

image


For example, I want DT_Var to be assigned the DataTable I want based on a condition.

image

Hi

For this you can assign using assign activity and use expression like this

DT_Var = if(expression condition, value if condition is true, value if condition is false)

Hi,

FYI, another approach without if:

dict = New Dictionary(Of Boolean, DataTable)From{{true,dtA},{false,dtB}}

dict is Dictionary<Boolean, DataTable> type

Then, the following will work.

dict(condition).Rows(0).Item(0).ToString

Sample20230206-1L.zip (2.7 KB)

Regards,

2 Likes

This worked perfectly!

1 Like

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