3

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)) }"/>+
1
  • Have you tried using the TEXT() function to convert the round value to text? Also you have a plus sign at the end of the line, is that in your code? Jun 13, 2019 at 19:27

1 Answer 1

3

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)))}"/>
2
  • It worked, thank you for your help.
    – Abby
    Jun 13, 2019 at 19:51
  • Glad that it worked and that I was able to help.
    – Jayant Das
    Jun 13, 2019 at 23:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .