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
sravikasravika 

Need immediate help

I need a solution for this requirment..could u please help me in this context.

 

I have two conditions where in the first one I have to display the value of Formula field by calculating its value in the controller itself.

In the second case i need to display its value from the page(formula given during the field creation) into the same controller..

 

It is something like

 if(true)

{

display field value by calculating it in the controller

}
else

{

  display the value of the formula field directly

}

 

Best Answer chosen by Admin (Salesforce Developers) 
prady-cmprady-cm

Hi Sravika,

 

on your VF page

 

 <apex:outputText value="{!item.calcInController}" rendered="{!item.condition ==true}"/>
  <apex:outputText value="{!item.calcInFormula}" rendered="{!item.condition ==false}"/>
  

 

Have 2 output texts and only one would render based on the condition.

Let me know if you need further clarifications

 

 

 

 

All Answers

prady-cmprady-cm

Hi Sravika,

 

on your VF page

 

 <apex:outputText value="{!item.calcInController}" rendered="{!item.condition ==true}"/>
  <apex:outputText value="{!item.calcInFormula}" rendered="{!item.condition ==false}"/>
  

 

Have 2 output texts and only one would render based on the condition.

Let me know if you need further clarifications

 

 

 

 

This was selected as the best answer
Shiv ShankarShiv Shankar

1. Note : you can not insert vales in formula field.

 

2. you can use stored value in it.

 

3. Property x = your computaion * forumala field -------------------------------- showing the result x can be possibe on VF page.

 

Ex:

public interger x {

      get{   

                if(true){

                       return (3 * 5)*formula field;  /  /do your  computaion

                 }

                else{

                      return formulafield;

                 }

       }

    set;

}

 

 

display x in VF page.