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
Shelly NyeinShelly Nyein 

IF else condition in visualforce page.

Hi, I'm using the below code in visualforce page, it is working fine when I have "Opportunity.Commerical_Value__c" value, but if Opportunity.Commerical_Value__c doesn't have any value, it always return null. What I want is to have something like this "Opportunity.amount - 0 when Commercial_Value__c is empty. 
Anyone could help me on this? THank you in advance. 

<apex:outputText value="{0, number, Currency}"> <apex:param value="{!Opportunity.amount - Opportunity.Commerical_Value__c}" /> </apex:outputText>
sfdcMonkey.comsfdcMonkey.com
<apex:param value="{!Opportunity.amount - (Opportunity.Commerical_Value__c != null ? Opportunity.Commerical_Value__c : 0)}" />
try like this 

Thanks let us know if it helps you
 
Mayank_SareenMayank_Sareen
Hi Shelly,
You can use if else statement in visualforce:
Syntax: {!IF(condition,'YES','NO')}
<apex:param value="{!IF(Opportunity.Commerical_Value__c==null,0,Opportunity.Commerical_Value__c)}" />
Tell us if it helps.

Mayank Sareen
AppPerfect Corp.
salesforce@appperfect.com
408-252-4100
http://www.appperfect.com/services/salesforce/
Salesforce Development & Operations Experts