Skip to main content
added 51 characters in body
Source Link
Guy Clairbois
  • 10.7k
  • 32
  • 54

I usually solve this by mis-using some other currency field (e.g. create an extra CustomObjA, without ever saving it to the database) and putting the result of the calculation in that field. Then show that field on the screen.

in apex add a public variable for it:

public CustomObjA cust2 {get;set;}

and fill it whenever you need to do the calculation:

cust2 = new CustomObjA();
cust2.CurrencyIsoCode = cust.CurrencyIsoCode;
cust2.customCurrentyField1 = cust.customCurrencyField1 - cust.customCurrencyField2;

in visualforce (wrap in e.g. pageblockSectionItem since the label will be wrong):

<apex:pageBlockSectionItem>
   <apex:outputLabel value="Your custom label" />
   <apex:outputField value="{!cust2.customCurrencyField1}" />
<\apex:pageBlockSectionItem>

I usually solve this by mis-using some other currency field (e.g. create an extra CustomObjA, without ever saving it to the database) and putting the result of the calculation in that field. Then show that field on the screen.

in apex add a public variable for it:

public CustomObjA cust2 {get;set;}

and fill it whenever you need to do the calculation:

cust2 = new CustomObjA();
cust2.customCurrentyField1 = cust.customCurrencyField1 - cust.customCurrencyField2;

in visualforce (wrap in e.g. pageblockSectionItem since the label will be wrong):

<apex:pageBlockSectionItem>
   <apex:outputLabel value="Your custom label" />
   <apex:outputField value="{!cust2.customCurrencyField1}" />
<\apex:pageBlockSectionItem>

I usually solve this by mis-using some other currency field (e.g. create an extra CustomObjA, without ever saving it to the database) and putting the result of the calculation in that field. Then show that field on the screen.

in apex add a public variable for it:

public CustomObjA cust2 {get;set;}

and fill it whenever you need to do the calculation:

cust2 = new CustomObjA();
cust2.CurrencyIsoCode = cust.CurrencyIsoCode;
cust2.customCurrentyField1 = cust.customCurrencyField1 - cust.customCurrencyField2;

in visualforce (wrap in e.g. pageblockSectionItem since the label will be wrong):

<apex:pageBlockSectionItem>
   <apex:outputLabel value="Your custom label" />
   <apex:outputField value="{!cust2.customCurrencyField1}" />
<\apex:pageBlockSectionItem>
Source Link
Guy Clairbois
  • 10.7k
  • 32
  • 54

I usually solve this by mis-using some other currency field (e.g. create an extra CustomObjA, without ever saving it to the database) and putting the result of the calculation in that field. Then show that field on the screen.

in apex add a public variable for it:

public CustomObjA cust2 {get;set;}

and fill it whenever you need to do the calculation:

cust2 = new CustomObjA();
cust2.customCurrentyField1 = cust.customCurrencyField1 - cust.customCurrencyField2;

in visualforce (wrap in e.g. pageblockSectionItem since the label will be wrong):

<apex:pageBlockSectionItem>
   <apex:outputLabel value="Your custom label" />
   <apex:outputField value="{!cust2.customCurrencyField1}" />
<\apex:pageBlockSectionItem>