Assigning a value from a DataTable to a DataRow Array

Hi all, I’m following some videos from Cope Automation on YouTube to improve my UI path skills. He uses the usual ACME system (ACME System 1 - Log In) and the first action is to scrape some of the work items in to a data table called ExtractDataTable - this works fine.

He then uses this script ExtractDataTable.Select(“Type=‘W13’ and Status=‘Open’”) to assign to a Data Row array and then a 2nd assign of FilterDataRow.CopyToDataTable to copy to a Data Table (I think the video will then carry on to using a For Each or something similar activity but I haven’t got that far yet due to my error below)

When I step through, in my DataRow array variable I get the following result - DataRow[0] { }

I do not understand why I am getting that message or what that means. Please can somebody explain why and help me fix the issue? I can post my xmal if it helps.

Thanks in advance.


I guess after filter there isn’t any data in your data row array.

Please check your data table filter condition and also check if your extracted data table contains data.

Karthik Byggari

Hi Karthik, thanks for kindly replying. I still can’t solve the issue. Please can you look at my xmal if you get the time and see if you have better luck. Main.xaml (8.3 KB)

Thanks for the help

You must have in mind that ACME website displays random Work Items, this means you can have a different scenario where the condition (“Type=‘W13’ and Status=‘Open’”) is not met, and that is the reason the FilterDataRow variable is empty. Also, after reviewing your xaml file, I can see you have a limit of 20 records for the Extract Structured Table, this means you are restricting the amount of data obtained from the extraction, so I would suggest changing that to 0 to get every record from the website.

An additional tip: do not use CopyToDataTable without first being sure that your DataRows has at least one record, otherwise your process is going to crash, as the CopyToDataTable method expects that the DataRows are not empty or null.

That makes perfect sense, thank you so much for replying. Please can I ask the code I can write in an IF stage to check that the data row has been populated. Would it be something around checking that a row exists by checking it’s >0?

Thanks again

Exactly, it would be something like FilterDataRows.Count > 0.

1 Like

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