BAQ help

Hi All,

I have a BAQ that returns part from a selected vendor and displays the last PO date, I’ve been asked now to make it so that if a part from that vendor has not been ordered then the last PO date column should be blank, how do I make my calculated field to say if purchased before display last PO date if not then leave blank?

I’m assuming I need to use a condition in the calculated field but not sure of how to string it all together.

1 Like

So far I’ve gotten this far but am getting an error.

This is the format of a case statement:

Case 
when SubQuery3.PartXRefVend_LeadTime <> 0 then SubQuery3.PartXRefVend_LeadTime
when SubQuery3.VendPart1_LeadTime <> 0 then SubQuery3.VendPart1_LeadTime
else 0
end

True should not be enclosed in character markers. Try without the apostrophy.

You can’t set another field in the calculated field, so on the else, you need to get rid of the field you are trying to set, and just make it null.

Depending on the field, you might not be able to make a date field null. You might have to case it to a character field to get that to work, and obviously that means losing some of the dateyness of the field, so that’s a tradeoff.

Can you share the diagram view of your BAQ? You might be able to make this work by changing the type of join to the PO detail table.

Tried, still get same error

Also, orderdate can’t be “true”… This isn’t javascript.

So I got to here and then got this error.

So I tried ticking the Group by on the calc field and got a different error.

:sweat_smile: I’m trying

1 Like

Here is diagram of my Top Level and then my Subquery.

Got it! changed join type on my toplevel between PartPlant and SubQuery from matching “Rows from PartPlane and SubQuery2” to “All Rows from PartPlant and SubQuery2” and bingo it worked! Thank you very much

1 Like

Glad it worked - happy to help!