Fetch data from datatable based on some key

I am trying to fetch data from datatable based on particular row value, refer below data table.

Now from this table i want to put some condition like if temp exists in this datatable then fetch date and value.

Thanks in advance.

Hi @Riya_Bansal,

You can use Filter Datatable activity to filter this datatable, that will give you the output values in a datatable format.

@sarathi125 I don’t want to filter this table, i just want to fetch the value of date and value for every name.
say for temp i want it’s date and value same goes for BP and other columns

Hi @Riya_Bansal

The Filter Data Table Activity will leave, as @sarathi125 mentioned, only the rows with i.e. “Temp” in the first Column.

To get the Date or Value, however, you may want to use a “Lookup Data Table”. Keep in mind, this will give you the first Hit (Cell Value - or RowIndex) when it finds your LookupValue (“Temp”). In case you’d like to print all values, use a “For Each Row in Data Table” Activity (loop through your filtered Data Table) and print every Date or Value for the current iteration.

By the way: In your message box I’m noticing you may not have loaded your Datatable with “Headers” (if you were using “Read Range” - Excel Activity - make sure to tick ‘AddHeaders’ in the properties).

Best regards
Roman

1 Like

You can use linq query to filter out the datas you need

datatable.asenumerable.where(function(row) row(columnname).tostring.tolower.equals(“temp”)).copytodatatable

Please try this

Regards

Sreejith S S

1 Like

Thankyou guys it worked!

If it helps you please close the topic by marking it as solution

Regards

Sreejith S S

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