You need to sign in to do that
Don't have an account?
Sarah Osburn
Enterprise Ed: How to replace null or empty number value with 0 - in VF
I'm getting a syntax error. Sorry, I know this post is a bit old but the only discussion about this topic. I want to replace a null value with $0. Here is my line of code:
<td><apex:outputField value="{! IF(OR(ISNULL(ACT_ROF__c.Additional_Profits__c) ,ISBLANK(ACT_ROF__c.Additional_Profits__c)), 0, ACT_ROF__c.Additional_Profits__c }"/></td>
I'm apparently adding an extra comma somewhere but have no clue where.....??
Error: Syntax error. Extra ','
<td><apex:outputField value="{! IF(OR(ISNULL(ACT_ROF__c.Additional_Profits__c) ,ISBLANK(ACT_ROF__c.Additional_Profits__c)), 0, ACT_ROF__c.Additional_Profits__c }"/></td>
I'm apparently adding an extra comma somewhere but have no clue where.....??
Error: Syntax error. Extra ','
<td><apex:outputField value="{! IF(OR(ISNULL(ACT_ROF__c.Additional_Profits__c) ,ISBLANK(ACT_ROF__c.Additional_Profits__c)), 0, ACT_ROF__c.Additional_Profits__c) }"/></td>
<td><apex:outputText rendered="{!ISBLANK(ACT_ROF__c.Additional_Profits__c)}">0</outputText><apex:outputField value="{!ACT_ROF__c.Additional_Profits__c}" rendered="{!NOT(ISBLANK(ACT_ROF__c.Additional_Profits__c))}"/></td>
You don't need to check for ISNULL, it's covered by ISBLANK.
We can't use output field for custom value. We need to use only when we are using filed either custom or standard.
So,
as suggested by kevin its should be like this
<td><apex:outputText value="{! IF(OR(ISNULL(ACT_ROF__c.Additional_Profits__c) ,ISBLANK(Image_Upload__c.Name)), 0, ACT_ROF__c.Additional_Profits__c) }"/></td>
OR
<td><apex:outputText value="{! 0}" rendered="{!OR(ISNULL(ACT_ROF__c.Additional_Profits__c) ,ISBLANK(ACT_ROF__c.Additional_Profits__c))}"/></td>
<td><apex:outputField value="{! ACT_ROF__c.Additional_Profits__c}" rendered="{!OR(ACT_ROF__c.Additional_Profits__c!=NULL ,ACT_ROF__c.Additional_Profits__c!='')}"/></td>
Thanks
Praveen Murugesan
<td><apex:outputText value="{!IF(ISBLANK(ACT_ROF__c.Additional_Profits__c),'$0',ACT_ROF__c.Additional_Profits__c)}"/></td>
What is the data type of the ACT_ROF__c.Additional_Profits__c field? That field may not be displayed correctly in the user's locale format if you use outputText.