Uipath Academy Level 3 assignment (datatable)

I am working on the assignment of uipath academy training and don’t know how to deal with a datatable issue.

How to filter a datatable with empty row?

My Situation

My task is to invoke a workflow to extract some data from a web using “data scraping” in form of a datatable and then output the datatable out from the workflow. After that, I gotta filter the datatable with the .select() function.

Exception happens in the “assign” activity, which is for filtering the datatable into datarow.

After checking, I find that only when I adjust the MaxNumberOfResults> number of data being processed or = 0, the issue happen. So, I think the issue happens when I filter a datatable with empty row. How should I solve it?

Hello @karlkong, just for curiousity, why would you like to scrape data with 0 as max result? o.O

Anyway, how about adding a simple if before the filter?
Only if dttableout.Rows.Count > 0, you go on with the filter.

Under the situation of not knowing the exact number of data to be extracted, isn’t setting 0 the best way?

Max Results = 0 means scrape all data.

I had a similar issue which seems to be related to the fact the DataTable variable is not initialized as it is used directly by the scraping activity. Try adding the below Default value for the Output variable of the scraping activity.

Whoops. Shame of me. Forgot all the settings already.
Thank you :wink:

I have tried to set the default value of the “dt_WIList” to a new datatable. The “dt_WIList” is then used to receive the output datatable from the “Invoke Extract data table varaibel workflow”. Still, it doesn’t work.

Should I also set a default value for the WIList?

My advice would be to do the filtering while scraping data. Only add work items of the type you need (WI5 or WI4) to your datatable, skip the others :slight_smile:

Having a large datatable and then picking the items you need is less efficient and more complicated.

Hi trog,

How can we do that ?. Where we have to specify the condition while performing Data Scraping?

Hi, I had tried web recording (text then copy text) to just copy the WI5 and Open data…But not able to get the desired output. Please let us know how to do this.