Hi friends,
What is the best practice of filtering data. Thru Excel or DataTable ?
cheers
Happy learning
Hi friends,
What is the best practice of filtering data. Thru Excel or DataTable ?
cheers
Happy learning
I would suggest the data table would be better… But this could depend on the scenario we are in too…
If we have the capability of omitting some records we could configure the read range as well to start from the row we need.
Hi @pattyricarte
From my current projects, the best approach would be saving the filtering condition in seperate Excel file, then form the query based on that
Ex
This is my pseudo-code :
In excel file
Name brse;se;pm;coe
In Studio, you split the {brse;se;pm;coe} string to [brse, se, pm, coe] based on delimiter “;”
Assume that queryArr = [brse, se, pm, coe]
Initialize queryStr = “”
Then form the query :
For each element in queryArr :
If element.equals(queryArr.last()) :
queryStr = queryStr + "job = " + element
Else
queryStr = queryStr + "job = " + element + " OR "
End If
End For
The query now would be like
job = "brse" OR job = "se" OR job = "pm" OR job = "coe"
When you want to change the condition of the query, just add or remove elements in the Excel File, you don’t need to change in the code. This would save you ton of time if the project is huge.
It’s better to save those conditions somewhere else, not in the code. It’s more flexible.
If you filter using data table, you have to read it first and then after filtering, you are supposed to write it.
If you are using excel to filter the data, then there would be game of send hotkeys or clicks to remove the columns and rows.
Another point to keep in mind is that from which location you are accessing the file. If it is on shared location, it is good to work on data table in place of excel sheet, to avoid network latency.
Using which approach out of two also depends on the size of data you are working on.
Hi @Purvi
you are saying that if i have a big data i must to use datatable right ?
cheers
Happy learning
Do we have any activities to filter the excel @pattyricarte We have one where we the data in excel needs to be in tabulated form and then you have to pass that table name to the activity. If the data is not in the tabular form, then you have to write the code to filter excel.
I would say we have only one option that is FIlter Data Table even it is huge data or small data.
Correct me if I’m wrong
I would agree with hareeshMR. Creating custom code sets to perform actions that can already be performed with the base functionality of UiPath is not preferable. Best practice for filtering data from Excel would be to use the Filter Data Table action, as we already have the action built in to UiPath.
There may be a case where filtering in Excel is the better option, but that would be on a case by case basis, and I have not encountered it yet.
Cheers!
@pattyricarte @HareeshMR @Lahiru.Fernando @martinw3
Hi guys as I dont want to repeat your valuable statements. Just let me add:
Hi Friends,
Thanks all for sharing all your thoughts about the topic.
cheers
Happy learning