Is there any way to automatically change the sql search criteria for this kind of search

I currently have an Excel sheet that looks like this, but I want to use “Group By” to narrow down the circled areas, and “Having” to narrow down the areas with the yellow backgrouund color.

2021-11-21 (2)

I would like the circled column to be narrowed down by “Group by”, and the yellow background area to be narrowed down by Having.

【image】
select * from DataTable grouping by Ship to Address, Street 2 having Quantity > 5

In the above image, the “Req.Del.Date” column is blank, but if it does, I would like it to become a search condition for grouping.

2021-11-21 (4)

【image】
Before: select * from DataTable grouping by Ship to Address, Street 2 having Quantity > 5
After: select * from DataTable grouping by Ship to Address, Street 2, Req.Del.Date having Quantity < 10

I would like to change the search condition in the spl depending on Excel value by Uipath.
Do you have any idea?

Thank you for reading

1)you can read the whole excel into a datatable sat DT
2)then use filter datatable on DT to select where “Req.Del.Date” is empty and store it to another datatable DT1
3)then use filter datatable on DT to select where “Req.Del.Date” is not empty and store it to another datatable DT2
4)now you can write these two datatables to two different excel files name one as(“with_Req_Del_Date”) and another as ((“without_Req_Del_Date”)
5)Now apply the SQL queries that you have based on the column type while reading the above two excel files

Another alternative is to do the grouping in uipath(LINQ) but it may be a bit complicated as you already have the SQL version available its better to use that.
Thank you

1 Like

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