Scribe Tip # 24 – Managing Complex Formulas in the Workbench

Another method that I use is to save complex parts of the formula as user variables. So in this formula I am trying to figure out the default Ship VIA method on a customer. So my rule is going to be to look up the specific value in the pick list mapping table, and if you can’t find it there use a default value we have in another table .  

Basically if A=Null use B, else use A.   

I found that Scribe and the CRM API does not deal with a NULL value well.  So I have used this model for all my picklist mappings.   So If(IsError (A,B,A))  This will tell us A if the value is valid but if it returns a NULL then B will be used.

So here is how it looks:   Complex Version:

If(Iserror(
        DBLOOKUP2( S76,
                 "OrderShippingMethodCode.ShipViaID" , "I", "InfuseMappingCRMtoSolomon", "FromValue", "Entity", "ToValue" )),      

Dblookup2("Solomon",
                   "ShipViaID","I","InfuseSettings","System","FieldName","FieldValue",
        DBLOOKUP2( S76,
                    "OrderShippingMethodCode.ShipViaID" , "I", "InfuseMappingCRMtoSolomon", "FromValue",  "Entity", "ToValue" ))

Simple Version:

If(Iserror(CRM2SolShipViaID), DefaultShipViaID, CRM2SolShipViaID)

Each DBlookup is made into a Variable, and then this becomes a much simpler formula to work with, and modify. 

 
Trackbacks
  • No trackbacks exist for this entry.
Comments

  • July 14, 2009 pandora wrote:
    "Each DBlookup is made into a Variable ..."

    Well, that's bascially the whole trick. Should be pretty obvious to do it that way, no?
    Reply to this
  • June 19, 2010 blogging for dummies wrote:
    This post is about another method that the author use to save complex parts of the formula as user variables. Through this post he shows the readers how to figure out the default Ship VIA method on a customer. The solution is simple and easily understandable by all the readers. I am really impressed with your post and I will definitely suggest this post to all my friends. As each DBlookup is made into a Variable, and then this becomes a much simpler formula to work with, and modify and that makes this technique an important one.
    Reply to this
Leave a comment

 Enter the above security code (required)

 Name (required)

 Email (will not be published) (required)

Your comment is 0 characters limited to 3000 characters.