I have a data table generated from a read range activity that kinda looks like this:
Now based on the input, I want to display values from the specific cell, like if the product is X and if the price is USD is asked then I must return 10.
How do I do this? I’m able to filter columns individually but, I’m not able to filter them by specific row. Kindly help!
This is still giving me all the rows’ value. I want to extract info based on two inputs only like Prod Y and USD should return 15. I kinda want to make it work like “read cell” activity but from the inputs I give.
Hi @monsieurrahul
Use Following Linq query to filter datatable. dt.AsEnumerable().Where(Function(r) CStr(“yourcolumnName”).Equals(“Value”) And CStr(“YoursecondColumn”).Equals(“SeconValue”)).CopyToDataTable
Getting the specific datarow from dt using the following linq,
reqRow = testDt.AsEnumerable().where(Function(x) x(0).ToString.Equals(“Prod X”)).FirstOrDefault()
this will return the exact row by looking the first column(index=0) = “Prod X”. It will validate this input string with all the rows. If it matches then it will return the whole datarow.
Then we can get the value of usd or inr by calling them via index
usd = reqRow(1).ToString
inr = reqRow(2).ToString
Note : you can pass this string “Prod X” as dynamic variable inside the above linq. It will return value as per the dynamic variable.