In the BAQ SQL Editor can I populate another field based on the Date

I want to look at the Invoice Due Date and if it’s > than TODAY I want you to enter the value from the InvcDtl_ExtPrice in a field called Future. Can this be done in Calculated Field SQL Editor?

@wellsth Sure use a case when statement

I tried using a case statement, but I continue to get a syntax error. I used the following case statement:

(case when InvcHead.DueDate > Constants.Today then InvcDtl.ExtPrice else 0 end)

When I check the syntax I get the following error:
Incorrect syntax near ‘<’, Incorrect syntax near ‘OrderInvo’.

Any idea what I’m doing incorrectly?

Could another calculated field be causing that error?
I have this calculation and it works without an error.
Future_Calc

2 Likes

@wellsth I think @Larry-CS is correct. Look at the generated SQL statement. If you post the query we might see another issue.

I agree with @Larry-CS, syntax checking on a BAQ calculated field checks ALL fields and returns errors for any of them, not just the one you’re working on.

1 Like