I have a data table stored in a dt variable.
I need to extract the values of the specific row of this dt (by its index, row(index)) to a string variable Row_Value.
The way I can do it now is through the Output DataTable activity, and then splitting the output string by a Newline delimiter. I believe this is not the most effective way to do this simple operation.
For each row activity is also not good as I need the value of only ONE single specific row, and don’t want to cycle through the whole DataTable.
Can anyone advise me what are the alternative ways to do it?
The link below can be helpful in your scenario
Coulmnnunber can be replaced with columnname as well
If you have some fixed rules to select row
You can use <,>, like ,= in select function
Thank you very much. It works. I did not know that “item” is a word for a column.
This Select feature is very powerful. Thank you for your advice.
I have 2 questions if you don’t mind:
- I do YourDT.select(“columnname =‘yourcondition’”).copytoDatatable however the data table and assign the returned value to the NewDT. However in case DT doesn’t have the rows matching ‘yourcondition’ the assign activity throws an error. What is a good way to bypass it ?
- Where can I read more about the select and other DT functions ? Can you please send me the link to the resources available if any ?
- Put it in try catch block and catch invalid operation or argument exception. Or you can use enumrable methods for same.
2.you can refer this DataTable Class (System.Data) | Microsoft Docs
Thank you @rahatadi
However I don’t understand how to recover. In the catch block I do 1 second delay and then repeat Append range. However it helps in 50% cases only. In the other 50% it does not.
Please disregard my previous response. It is on a different topic.
Thank you for advising me on the Try Catch, I will definitely test it.
However I’m not familiar with the enumerable methods. Please
advise me the link where I can read about them.
Thanks for the link to the datatable class.
I found that in case the column name contains more than 1 word the Select methos doesn’t work as expected. I tried to put it in single quotes but it did not work either.
Is there also a way not to use the column names but rather the column indexes ?