+ Start a Discussion
snippets@sfsnippets@sf 

Visual Force page Code

Can anyone suggest the best way to achive this.

 

1. A Number value say 2500.00. has to be displayed in visual force page.

 

Things to consider is 

1. Whole no should be displayed

2. if no value then display "n/a".

 

Final Expected value if not null is : $ 2500

Final value if null is : n/a

 

We can get number format by this

<apex:outputText value="{0,number,#,###,###}">
<apex:param value="{!Lead.number__c}"/>
</apex:outputText>

 

They way I have implemented is 

 

<apex:outputPanel id="years_of_exp" rendered="{!IF(Lead.number__c==null || Lead.number__c==0, true,false)}">
N/A
</apex:outputPanel>
<apex:outputText rendered="{!IF(Lead.number__c!=null, true,false)}">
$
</apex:outputText>
<apex:outputText value="{0,number,#,###,###}">
<apex:param value="{!Lead.Number__C}"/>
</apex:outputText>

 

2. i have multi picklist values to be displayed.

 

Eg:  value in db is light;bulb;tube;led;

 

but i want to display as

 

light, bulb, tube, led.

 

Right now i am using javascript at the front end and displaying the expected output.

 

i wam wondering there should be a better way.

 

 

Above two solution are expected in front end..

 

 

Thanks ,

Snippets

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Dhaval PanchalDhaval Panchal

try this,

 

<apex:outputText value="{!if(NULLVALUE(Lead.Number__c,0)>0,'$ ','n/a')} {0, number,###,###,##}" >
	<apex:param value="{!Lead.Number__c}" />
</apex:outputText>

All Answers

Dhaval PanchalDhaval Panchal

try this,

 

<apex:outputText value="{!if(NULLVALUE(Lead.Number__c,0)>0,'$ ','n/a')} {0, number,###,###,##}" >
	<apex:param value="{!Lead.Number__c}" />
</apex:outputText>
This was selected as the best answer
snippets@sfsnippets@sf

Thanks.

 

dapanchal. it worked for me