2.02-12 No Hardcoding to List members

Avoid direct references to list item. E.g.  IF ITEM(list)=list.xx.  Instead, attempt to use a SYS module with a line item having a boolean format as this makes the formula more dynamic (multiple members can use the same logic).

Comments

  • Rule 2.02-12 No Hardcoding to List MembersAvoid direct references to list item. E.g. IF ITEM(list) = list.xx. It goes against SUSTAINABLE elements of PLANS if you wish to go against this rule

    Here is how it was done in Pre Planual Era:

    Hardcoding to list items used to be a norm. For example I had to write IF Account 1 then 1, IF Account 2 OR Account 3 then 2 and IF Account 4 & 5 then 3.

    Formula might look like

    Misbah_0-1591608471620.png

     

    What is wrong with this method

    For Production Lists: You will not be able to make this list as Production List, if need arises in the future, compromising your ALM settings

    Misbah_1-1591608471627.png

    For Non Production Lists: Maintaining this is extremely laborious and tricky. You have to check all the references of that particular list in the model and change it manually everywhere.  Any change in the list item’s logic or addition of list item which shares the logic with any other list item are few examples/cases

    Here is how it should be done in Planual Way:

    Step 1: Create a module dimensioned by GL Accounts List and Insert as many line items as there are logics to be written against. Check the Accounts in their respective buckets i.e., Account 1 in Logic 1, Account 2 and 3 in Logic 2 and rest in Logic 3

    Misbah_2-1591608471632.png

    Step 2: Refer the above Boolean formatted line items instead of list items in your formula

    Misbah_3-1591608471634.png

  • Hello @rob_marshall, I want to know is there any impact on performance if we directly refer non-production list member in our formula rather than referring it from a system module with same list formatted line item. Please find below screenshot for more clarity:-

    1.One way :- IF Account Coverage = Account Coverage.'Federal - DOD' THEN 'SYS 05'.FED DOD[LOOKUP: Zip Code] ELSE IF Account Coverage = Account Coverage.'Federal - Civilian' THEN 'SYS 05'.FED CIVILIAN[LOOKUP: Zip Code] ELSE IF Account Coverage = Account Coverage.'Federal - Healthcare' THEN 'SYS 05'.FED HEALTHCARE[LOOKUP: Zip Code] ELSE Blank

    2. Second way: -IF Account Coverage = 'SYS 21 : Formula References'.'Federal - DOD' THEN 'SYS 05'.FED DOD[LOOKUP: Zip Code] ELSE IF Account Coverage = 'SYS 21 : Formula References'.'Federal - Civilian' THEN 'SYS 05'.FED CIVILIAN[LOOKUP: Zip Code] ELSE IF Account Coverage = 'SYS 21 : Formula References'.'Federal - Healthcare' THEN 'SYS 05'.FED HEALTHCARE[LOOKUP: Zip Code] ELSE Blank

    -Is there any performance improvement if we use second way of writing?

    -Is there any other benefits using the second way other than flexibility to change list as production in future?

  • @kedar_p

    Form a lookup perspective, no, but from a calculation perspective, absolutely. It would be better to create a SYS module for Account Coverage and have a mapping line item (called Zip Code) with the zip codes defined for Federal - DOD, Federal - Civilian, and Federal - Healthcare. So the formula would be:

    SYS Account Coverage.Zip Code[lookup:Account Coverage]

    The less IF statements the better. Remember, the if statement has 3 different calcs, the IF part, the THEN part, and the ELSE part. If you can minimize those, the formula would be better.

    You want to stay away from hardcoding as much as possible as it limits the scalability of your model.