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
MattMet86MattMet86 

VisualForce - Remove decimal from value pulled using !$User resource

I can't seem to get the syntax right on this function. My goal is to simply remove the decimal point value from my number as this value is always a whole number. 
 
<apex:outputText value="{!Math.Floor({!$User.Performance_Points_MTD_User__c})}"/><br/>

Any ideas? 
 
Best Answer chosen by MattMet86
Antonio ManenteAntonio Manente
If I'm not mistaken the actual Math.floor() function isn't available in a VF component like that. One alternative would be to bind it to a variable in your controller and do the conversion there.. Alternatively, I believe you could use the FLOOR function. 

e.g.
<apex:outputText value="{!Floor($User.Performance_Points_MTD_User__c)}"/><br/>

If that ^^ doesn't work, then I'd suggest performing that logic in your controller.

All Answers

Antonio ManenteAntonio Manente
If I'm not mistaken the actual Math.floor() function isn't available in a VF component like that. One alternative would be to bind it to a variable in your controller and do the conversion there.. Alternatively, I believe you could use the FLOOR function. 

e.g.
<apex:outputText value="{!Floor($User.Performance_Points_MTD_User__c)}"/><br/>

If that ^^ doesn't work, then I'd suggest performing that logic in your controller.
This was selected as the best answer
MattMet86MattMet86
Your example code worked. I added the math.floor when I was trying to troubleshoot my syntax error. I was just adding too many curly brackets in the syntax. 
Antonio ManenteAntonio Manente
Awesome, glad I could help!