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
creece
07/26/2023, 3:28 AM
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
Luis
07/26/2023, 3:35 AM
This part works perfectly: MAX({custbody3}/{exchangerate})-SUM(NVL({applyingtransaction.fxamount},0))
c
creece
07/26/2023, 3:39 AM
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.
creece
07/26/2023, 3:43 AM
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
MGBC
07/26/2023, 4:40 AM
Try adding a summary function to {status}...ie CASE WHEN MAX({status}) = 'Pending Fulfillment' THEN ....etc
l
Luis
07/26/2023, 6:24 AM
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