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
LuvaraLuvara 

Rounding Numbers in Visualforce

I'm trying to round a number inside an IF statement, and haven't had any luck. I've seen in other threads that you can't use ROUND inside the "value" element..

 

Any ideas/help would be greatly appreciated..

 

Thanks! Chris

 

<apex:column width="150" > <apex:facet name="header">Visit Length</apex:facet> <apex:outputText value="{!IF(l.Length_of_Stay_in_Seconds__c<60, '{0} seconds', '{0} minutes')}"> <apex:param value="{!IF(l.Length_of_Stay_in_Seconds__c<60, l.Length_of_Stay_in_Seconds__c, l.Length_of_Stay_in_Seconds__c/60)}"/></apex:outputText> </apex:column>

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
LuvaraLuvara

Nevermind... figured it out another way without having to use ROUND...

 

Just used: {0,number, ##} instead.

All Answers

LuvaraLuvara

Nevermind... figured it out another way without having to use ROUND...

 

Just used: {0,number, ##} instead.

This was selected as the best answer
imcclellanimcclellan
Can you post your final code snippet too please?
LuvaraLuvara

<apex:outputText value="{!IF(p.TimeSinceLastVisit<60, '{0,number, ##} minutes ago', '{0,number, ##} hours ago')}"> <apex:param value="{!IF(p.TimeSinceLastVisit<60, p.TimeSinceLastVisit, p.TimeSinceLastVisit/60)}"/></apex:outputText>

 

Here you go..

 

Chris