2.02-15 FINDITEM on blanks

Doing a FINDITEM() on blank values is inefficient as the function has to traverse the entire list before it returns a blank.  

If the majority of the values are not blank, then check for BLANK first:

  • IF ISNOTBLANK(Line Item) THEN FINDITEM(List, line item) ELSE BLANK

If the majority are NOT blank:

  • If ISNOTBLANK(Line Item) THEN FINDITEM(List, line item) ELSE BLANK

If the majority are blank:

  • If ISBLANK(Line Item) THEN BLANK else FINDITEM(List, line item)

Depending on the the number of blanks the line item could have will dictate which formula to use.  If there are more blanks than not, then use the second formula.  If Line Item is more dense (has more values than not) then the first formula should be used.  If there will never be blanks in the values, there is no need to check for blanks:

  • FINDITEM(List, line item)

Related to Rule: 
2.02-17 Put the most common condition first 

 

Tagged:

Comments

  • Rule 2.02-15 FINDITEM on blanksIf the list being referenced does not contain blanks, there is no need to check for blanks with IF ISNOTBLANK(List) THEN FINDITEM(List, Text) ELSE BLANK. It goes against PERFORMANCE, NECESSARY elements of PLANS if you wish to go against this rule

    Here is how it was done in Pre Planual Era:

    Misbah_0-1591274132696.png

    Assumption:  Account Text is always going to be NON BLANK.

    What is wrong with this method?  Unnecessarily including IF ELSE statement and increasing the load on the engine

     Here is how it should be done in Planual Way:

    Misbah_1-1591274132703.png