I am trying to do an IF statement within a module dimensionalised by a List ('Volumes') which has 2 members: Retails and Wholesales.
I need to do a particular calculation depending on if the 'Volumes' are Retails or Wholesales.
I have tried IF Volumes.Retails THEN x ELSE y but this not work, giving the following error message:
The formula for 'XP 05 Derivative Mix'.Mix is invalid:First argument for 'IF' function must have BOOLEAN format not LIST:Volumes
Can anyone help / advise?
Go to Solution.
Formula Correction, try this
IF ITEM('Volumes')=Volumes.Retails THEN X ELSE Y
Hi @Riccardo @VIGNESH.M
For best practice (Refer to 2.02-12 of Planual), please avoid hardcoding of list member, and do the following instead
Hi @LipChean_Soh @ArunManickam ,
I totally agree with you, we should not do the hardcoding like this and instead use the system module as mentioned in Planula for the best practices.
@VIGNESH.M reply must work, but note that it is hardcoded. It is ok, if the list "Volumes" is fixed and does not change with time. If not,
Please create a system module for Volumes (SYS VOLUMES) and keep your boolean line item there (RETAIL & WHOLESALE). Manually maintainted by the administrator.
If 'SYS VOLUMES'.RETAIL then <<formula for RETAIL>> else if 'SYS VOLUMES'.WHOLESALE then <<formula for WHOLESALE>> else <<so on>>
There are ways to minimize the nested IFs as well.