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.