I’ve created a BAQ and published it as a dashboard in the Application Studio. However, I want to add additional filters through Application Studio to filter out rows where two particular columns are blank.
Something along the lines of:
(LaborDtl_LaborHrs = 0 AND Calculated_PartNum = ‘’) OR (Calculated_LaborHrs = 0 AND JobMtl1_PartNum = ‘’)
I have attempted to do this in the “Where” box of “Baq options” using this post as inspiration:
But I had no luck, my syntax does not seem to be correct.
Should I create an event and add a dataview filter? But then again I have the same issue of being unsure of correct syntax. Am I missing something obvious?
Below is the straight-quote version if you want to paste it in and test. (LaborDtl_LaborHrs = 0 AND Calculated_PartNum = '') OR (Calculated_LaborHrs = 0 AND JobMtl1_PartNum = '')
~*~
Another thing you may need to verify is… a string may not be empty (‘’). It could be undefined.
For example, when I’m writing conditions with regards to PartNum(s), I typically include undefined in my check.
Technically, strings can also be null. You could try the below, which checks all (3) (i think) and see if it works?
(LaborDtl_LaborHrs = 0 AND (Calculated_PartNum IS NULL OR Calculated_PartNum = '' OR Calculated_PartNum = 'undefined')) OR (Calculated_LaborHrs = 0 AND (JobMtl1_PartNum IS NULL OR JobMtl1_PartNum = '' OR JobMtl1_PartNum = 'undefined'))
(LaborDtl_LaborHrs <> 0 AND (Calculated_PartNum <> '' OR Calculated_PartNum IS NOT NULL))
AND
(Calculated_LaborHrs <> 0 AND (JobMtl1_PartNum <> '' OR JobMtl1_PartNum IS NOT NULL))
So, I’m using a different BAQ, so, ignore the columns I’m using… but I ran through a bunch of variations… all seemed to work:
QuoteDtl_PartNum = '??{Part.PartNum}'
Basic: Works as intended
QuoteDtl_PartNum = '??{Part.PartNum}' AND QuoteDtl_QuoteLine = 7
Basic ‘AND’: Works as intended
QuoteDtl_PartNum = '??{Part.PartNum}' AND QuoteDtl_QuoteLine = 7 OR QuoteDtl_QuoteLine = 12
‘AND’ + ‘OR’ Returned… almost as if I had parenthesis around the first two arguments.
I get the correct combination of PartNum & QuoteLine = 7
I then also get ALL PartNums where QuoteLine is 12.
QuoteDtl_PartNum = '??{Part.PartNum}' AND (QuoteDtl_QuoteLine = 7 OR QuoteDtl_QuoteLine = 12)
Added parenthesis around the 2nd & 3rd arguments:
Worked as you would expect… only returned combinations of PartNum and 7 AND PartNum and 12
QuoteDtl_PartNum = '??{Part.PartNum}' AND (QuoteDtl_QuoteLine = 7 OR QuoteDtl_QuoteLine = 12) OR QuoteDtl_QuoteNum = '36986'
Returned:
Combinations of PartNum and 7 AND PartNum and 12
AND all QuoteLines for QuoteNum ‘36986’
QuoteDtl_PartNum = '??{Part.PartNum}' AND (QuoteDtl_QuoteLine = 7 OR QuoteDtl_QuoteLine = 12) OR (QuoteDtl_PartNum = '??{Part.PartNum}' AND QuoteDtl_QuoteNum = '36986')
Returned:
Combinations of PartNum and 7 AND PartNum and 12
AND ONLY the QuoteLine for QuoteNum ‘36986’ where PartNum was correct.
(QuoteDtl_PartNum = '??{Part.PartNum}' AND QuoteDtl_QuoteLine = 7) OR QuoteDtl_QuoteLine = 12 OR (QuoteDtl_PartNum = '??{Part.PartNum}' AND QuoteDtl_QuoteNum = '36986')
Returned as expected:
PartNum & 7
All QuoteLines from all Quotes where QuoteLine = 12
PartNum & Quote 36986
(QuoteDtl_PartNum = '??{Part.PartNum}' AND QuoteDtl_QuoteLine = 7) OR (QuoteDtl_QuoteNum = '36986' AND QuoteDtl_QuoteLine = 2)
It seems to have filtered correctly:
018-01618 is the PartNum I called… and it only appears as Line 7 on Quote 52004.
It also returned QuoteNum 36986 Line 2, even though it is a different PartNum
((Calculated_LaborHrs <> 0 AND Calculated_LaborHrs IS NOT NULL) AND (JobMtl1_PartNum <> '' AND JobMtl1_PartNum IS NOT NULL))
as David said, pay close attn to your single quotes. If they are pasting into Kinetic as wavy like they are here that’s a problem. single quotes must be apostrophe.
yeah you definately wanna break it down to simple query so you know your seeing expected results. Many correct WHERE stmts on here but hard to say what’s what in a complex query.
PS - see if you can make it work in BAQ designer - with subquery tests then look at the WHERE clause(s) from the sql display. Maybe gleen some hints on how our suggestions apply to your complex circumstance