does anyone know what is wrong with my formula? Wh...
# general
l
does anyone know what is wrong with my formula? When I add the CASE WHEN part, it throws an unexpected error. Without that, it’s working fine. CASE WHEN {status} = ‘Pending Fulfillment’ THEN MAX({custbody3}/{exchangerate})-SUM(NVL({applyingtransaction.fxamount},0)) ELSE MAX(0) END I’ve tried to remove MAX for the 0, use SUM and MIN; none of them works
c
You could narrow it down by taking out the MAX and SUM and seeing if its giving you each piece like you want. I'm not seeing MAX as a supported SQL Expression for searches in the documentation.
l
This part works perfectly: MAX({custbody3}/{exchangerate})-SUM(NVL({applyingtransaction.fxamount},0))
c
is the field set to Formula Numeric? seems like the ELSE should be ELSE 0 not else MAX(0) as well but it may work as is.
other than that it looks OK to me unless it's looking for something like {transaction.status} but you could pull in status from the dropdown when creating the formula in the UI to double check.
m
Try adding a summary function to {status}...ie CASE WHEN MAX({status}) = 'Pending Fulfillment' THEN ....etc
l
It’s a formula currency field. Thanks both! @MGBC adding max to the status worked: CASE WHEN MAX({status}) = ‘Pending Fulfillment’ THEN MAX({custbody3}/{exchangerate})-SUM(NVL({applyingtransaction.fxamount},0)) ELSE 0 END