Maximiliano
08/22/2023, 3:40 PMLEAST(NVL({custitem_A}, 0), NVL({custitem_B}, 0), NVL({custitem_C}, 0))
Tried something like this as well however doesn't work: CASE WHEN NVL({custitem_A}, '') = '' THEN CASE WHEN NVL({custitem_B}, '') = '' THEN NVL({custitem_C}, 0) ELSE LEAST(NVL({custitem_B}, 0), NVL({custitem_C}, 0)) END ELSE CASE WHEN NVL({custitem_B}, '') = '' THEN LEAST(NVL({custitem_A}, 0), NVL({custitem_C}, 0)) ELSE LEAST(NVL({custitem_A}, 0), NVL({custitem_B}, 0), NVL({custitem_C}, 0)) END END
Any ideas?raghav
08/22/2023, 7:36 PMDavid B
08/22/2023, 8:51 PMCOALESCE(LEAST({A}, {B}), {A}, {B})
But for 3 fields it gets a bit messy:
LEAST(COALESCE({A},{B},{C})
,COALESCE({B},{A},{C})
,COALESCE({C},{A},{B}))
I think raghav's approach is what I'd use, it's easily extendable. I'd probably use binary_double_infinity
in case your field contains large numbers. Something like:
NULLIF(
LEAST(
NVL({A}, binary_double_infinity),
NVL({B}, binary_double_infinity),
NVL({C}, binary_double_infinity)
),
binary_double_infinity
)