+ Start a Discussion
etechcareersetechcareers 

IF THEN STATEMENT HELP IN VF Please??

What is wrong with my statement:

 

{!IF(metricname=='Overall',saname==null,'<apex:outputText value={!saname}/>' )}

 

 

Thanks

eTechCareers

Best Answer chosen by Admin (Salesforce Developers) 
MikeGinouMikeGinou

Assuming that what you were trying to get was an apex output text control that is only rendered if when metricname (probably a controller property) is set to overall, then you can accomplish this using the rendered property.

 

This results in a much nicer, and more VisualForce-ish code, as follows:

 

 

<apex:outputText value="{!saname}" rendered="{!(metricname=='Overall')}" />

 

 

All Answers

blombardisblombardis

Hi,

 

"saname==null" is wrong. What are you trying th achieve? I supose "saname" is a variable in your controller.

 

Please clarify for me to help you,

 

Bruno

ahab1372ahab1372

just replace saname==null with "" 

MikeGinouMikeGinou

Assuming that what you were trying to get was an apex output text control that is only rendered if when metricname (probably a controller property) is set to overall, then you can accomplish this using the rendered property.

 

This results in a much nicer, and more VisualForce-ish code, as follows:

 

 

<apex:outputText value="{!saname}" rendered="{!(metricname=='Overall')}" />

 

 

This was selected as the best answer