You need to sign in to do that
Don't have an account?
sharath chandra parsi
Unable to limit the size of decimal in formula field..!!
I am trying to write a formula field where i used arithmetic divison. I want to limit the size of decimal to 2 places which can be done using setScale in apex. But unable to apply the same to formula field.
formula is of kind TEXT(x/y) ------ working fine.
TEXT((x/y).setScale(2)) ----------- Not working.
formula is of kind TEXT(x/y) ------ working fine.
TEXT((x/y).setScale(2)) ----------- Not working.
Checked it by exucting simple code:
Decimal d = (5/2);
d = d.setScale(2);
system.debug('GM '+d);
37.0 APEX_CODE,DEBUG
Execute Anonymous: Decimal d = (5/2);
Execute Anonymous: d = d.setScale(2);
Execute Anonymous: system.debug('GM '+d);
12:53:44.16 (16023118)|EXECUTION_STARTED 12:53:44.16 (16028574)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex 12:53:44.16 (16529458)|USER_DEBUG|[3]|DEBUG|GM 2.00
12:53:44.16 (16570948)|CODE_UNIT_FINISHED|execute_anonymous_apex 12:53:44.16 (17810847)|EXECUTION_FINISHED
Regards,
GM
You can limit the Formula field to 2 decimal place by editing that field and changing the Formula Return Type = Number and Decimal Places=2.
Thnx