I am trying to send data to a BAQ with a subquery but I can’t seem to filter the BAQ at the top level by the values I have. I have done this successfully with a plain BAQ (no subqueries) by setting erp-baq > BAQ Execute Options > Where JobHead_JobNum = ‘{ReqDetail.JobNum}’
The BAQ this is referring to joins JobHead and Project so the JobHead_JobNum seems to correspond to the JobHead table and JobNum field.
My current BAQ I am trying to make work does the math in the subquery and at the top level, groups by the CustNum and finds the maximum value. I want that maximum value. I have a button used to test this BAQ query and displays the value in the dataview that is supposed to be populated but it always returns undefined.
I have tried removing the quotes in the last screenshot but no change. I have also tried addind Calculate_ShipToInc.ShipTo_CustNum in the WHERE clause but I didn’t see any change.
I will test this. I was able to reduce this to a 1 level BAQ and it is working. I needed to get this working so I removed some complexities to get it to the form I am comfortable working with.
And actually, I think one (?) is probably more suitable.
One question mark (?) will return results to the grid when it matches that value. So, ShipTo_CustNum = your Customer.CustNum value.
Two question marks (??) will return results to the grid even if a value isn’t provided (null). So, in that use case, you would get results in your grid even if Customer.CustNum is null.
So, one ? is probably the preferred way.
The Where Clause is nice when you want to chain things together with AND / OR statements, but you can also use the Where List in the BAQ options if that is more straight forward.