+ Start a Discussion
Sales Force FRMSales Force FRM 

How can i append negative sign to decimal number ?

Hi Folks,
                I need to assign negative sign to decimal number for example :

12 is decimal number then i have to append negative sign like   -12 and  save in to a cloumn called  'value' , this column is also a   type of decimal, is trhis possible if so how to do it else is there any other way to do it.


Regards,
Rajeshwar.
jpizzalajpizzala
If I understand you correctly, your example states that you will be putting the number 12 (or similar) into a numeric field (PositiveNumber__c) and another field (NegativeNumber__c) will display the negative of that number?

If so, you can create a formula field (of number type) with this:

Code:
IF( PositiveNumber__c > 0 , PositiveNumber__c - ( 2 * PositiveNumber__c ) , PositiveNumber__c )

 Note this will only make a number negative if PositiveNumber__c is greater than 0 (or positive).  Otherwise NegativeNumber__c will take the already negative number from the original field as its value.

If you put a negative number in the PostitiveNumber__c field, should it be converted to a positive number (absolute value)?

EDIT: if you want the "NegativeNumber__c" field to be a standard numeric field (not a formula field), you could create a workflow rule with a field update that applies the above formula.



Message Edited by jpizzala on 06-03-2008 02:45 PM