I need to write a BQL statement to select rows from SOOrder that are duplicated by 4 key fields. I want to select the duplicated rows for a processing page and allow the user to check the orders to delete. I have the page and all the logic prepared. I just need the BQL query to present the duplicates. Can someone give me a template query? I know I will need GroupBy and Aggregate.
1
votes
I have created a query that does the grouping and the count, but I have two issues. 1. I don't know how to select only those rows with a count greater than 1. 2. I don't know how to add the count value to the grid.
- Jerry Welliver
Here is the query: var cmd = new PXSelectGroupBy<SOOrder, Where<SOOrderExt.usrEDICustomerId, IsNotNull>, Aggregate<GroupBy<SOOrderExt.usrEDICustomerId, GroupBy<SOOrderExt.usrEDICustomerVendorId, GroupBy<SOOrder.customerOrderNbr, GroupBy<SOOrder.customerLocationID, Count<SOOrder.orderNbr>>>>>>, OrderBy<Asc<SOOrderExt.usrEDICustomerId, Asc<SOOrderExt.usrEDICustomerVendorId, Asc<SOOrder.customerOrderNbr, Asc<SOOrder.customerLocationID, Asc<SOOrder.customerRefNbr>>>>>>>(this);
- Jerry Welliver
you can add it as an answer and accept it, so others know you got it!! Thanks
- Sin