Extract required data from datatable

I am having a datatable with the below values

[
Science,Mathematics,Biology,Computer Science,Physics,Active View
False,False,True,True,False
]

I want to get values from the first datarow[0] by matching the true values from datarow[1]

Can anyone help me on this?

[
Science,Mathematics,Biology,Computer Science,Physics,Active View
False,False,True,True,False
]

Are those Headers? Or the values from a column?
Or 2 rows?

2 rows

It is a datatable with 2 rows.

Hi,

Can you try the following expression?

resultStringArray = dt.Columns.Cast(Of DataColumn).Where(Function(dc) dt.Rows(1)(dc).ToString="True").Select(Function(dc) dt.Rows(0)(dc).ToString).ToArray()

Regards,

Not completely sure about the question but are you looking for subject names that are true?

you may consider converting that to dictionary and then get the value

Also we can see there are 6 row headers and 5 row values. is that correct?

Each is a row without a header

Hi,

Here is a sample, FYI.

Sequence1.xaml (8.1 KB)

Hope this helps you.

Regards,

Thank a lot. Its Worked. :grinning:

1 Like

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