[SalesForce] Error: Incorrect parameter type for operator ‘+’. Expected Text, received Number

I need to add a special character for a field on VF page and it's throwing an exception.

Error: Incorrect parameter type for operator '+'. Expected Text, received Number

Can anyone help me with this, please?

<apex:outputText value="{! IF( ISBLANK(Quote.Total_Leasing_Costs__c), '-', '$'+Round(Quote.Total_Leasing_Costs__c,0)) }"/>+

Best Answer

Wrapping the ROUND() output within a TEXT() is what you need here. + in this context expects appending two string values whereas ROUND() returns a number and thus the error.

<apex:outputText value="{!IF(ISBLANK(Quote.Total_Leasing_Costs__c), '-', 
                        '$' + TEXT(Round(Quote.Total_Leasing_Costs__c,0)))}"/>
Related Topic