function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ChrisMcLChrisMcL 

multiple formulas on one field

Just wondering if anyone has a technique to split up formulas and make them exclusive (one does not overwrite the outcome of the other.
 
formula: if picklist is a certain value, lookup a number and multiply it by another number field. In real life, the case statement is hundreds of items long. How could I split up this statement into two for example?
 
I would like to make the multiplication dependent on whether the case statement found a match.
Code:
case(field,
"type1", 30,
"type2", 50,
amountfield) * field2

 
Do i use Ischanged?
ChrisMcLChrisMcL
I'll reply to my post, here is a way to do it. I don't like having to multiply in each statement, but I don't have a choice right now.
 
Code:
formula 1:

case(field,
"type1", 30* field2,
amountfield) 

formula 2:

case(field,
"type2", 50* field2,
amountfield) 

 


Message Edited by ChrisMcL on 12-14-2007 06:58 PM
RickyGRickyG
By 'not having a choice right now', can I assume you mean no access to Apex code?  Because if you did, I would create a custom object with the value from the picklist and the number to multiply it by.  Then you could create a trigger to do a lookup on the table and perform the multiplication.

That specific solution would require you to add a record to the object when you added values to the picklist.  A cleaner solution would be to simply populate the picklist from the object, which is pretty simple to do with Visualforce.  Visualforce is only available in Developer Edition at this time.

Hope this helps.
ChrisMcLChrisMcL

As a partner with Salesforce, we will not be using Apex code until it can be released inside managed packages. But thanks for the idea.

James