Apex:OutputText to Currency Format from String Wrapper

  • is there a way to pass a string to the <apex:outputText> so that it can be formatted as a currency or percent value?

    Here's what I have inside a column of my visual force table:

    <apex:outputText value="{0, number, currecny}">
    <apex:param value="{!row.values[1]}" />
    </apex:outputText
    

    this gives me an error at runtime (when the visual force page loads), which I think may be some kind of type mismatch, where <apex:outputText> is expecting a Decimal or number but I am passing a string.

    This is the error at runtime:

    The value attribute on is not in a valid format. It must be a positive number, and of type Number, Date, Time, or Choice.

    Thanks

  • Jeremy Ross

    Jeremy Ross Correct answer

    5 years ago

    The problem was you misspelled currency. This works fine and avoids hard coding the currency symbol:

    <apex:outputText value="{0, Number, Currency}">

License under CC-BY-SA with attribution


Content dated before 7/24/2021 11:53 AM

Tags used