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
ForceComForceCom 

Cannot render....Urgent !!!!

Hi 

 

I am trying to use the render function but it does not work for the if function ...

 

As an example...

 

rendered="{A.Session_Formula__c=='Fall 2010'}" works fine ....but 

 

rendered="If({A.Session_Formula__c=='Fall 2011'} || {A.Session_Formula__c=='Winter 2011'} ),true,false"

 

This does not work , I do not have an idea why this is behaving this way....

 

I would really appreciate any kind of help from anyone....

 

 

Thank you All .....

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
SteveBowerSteveBower

You're missing your "!"'s in your references to controller variables (unless they stripped from your post or something?).

 

 

 

Also, your If statement syntax is off...  it's   rendered="{!if(condition, true-value, false-value)}"

 

So, in your second if you may want:

 

 

rendered="{!if( ((A.Session_Formula__c == 'Fall 2011') || (A.Session_Formula__c == 'Winter 2011')), True, False)}"

 or just

 

 

rendered="{!if( ((A.Session_Formula__c == 'Fall 2011') || (A.Session_Formula__c == 'Winter 2011'))  )}"

 

 

 

BEst, Steve.

All Answers

SteveBowerSteveBower

You're missing your "!"'s in your references to controller variables (unless they stripped from your post or something?).

 

 

 

Also, your If statement syntax is off...  it's   rendered="{!if(condition, true-value, false-value)}"

 

So, in your second if you may want:

 

 

rendered="{!if( ((A.Session_Formula__c == 'Fall 2011') || (A.Session_Formula__c == 'Winter 2011')), True, False)}"

 or just

 

 

rendered="{!if( ((A.Session_Formula__c == 'Fall 2011') || (A.Session_Formula__c == 'Winter 2011'))  )}"

 

 

 

BEst, Steve.

This was selected as the best answer
ForceComForceCom

Thank you so much , for your reply and help.....

Kent ManningKent Manning

Is there some reason why you need the IF statement? 

 

The rendered attribute is a logical equation anyway - so if either, or both, of these statements is true,  A.Session_Formula__c=='Fall 2011'  OR  A.Session_Formula__c=='Winter 2011'  then rendered is going to happen.


So I think you could just write it as:

 

rendered={!A.Session_Formula__c=='Fall 2011 || !A.Session_Formula__c=='Winter 2011'}

 

and it should work.

SteveBowerSteveBower

You're right, I mistyped in my second example when I removed the results of the If, but didn't remove the "If" itself.  Best, Steve.