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

Amount, Date cannot be displayed formatted with Map

<apex:repeat value="{!params}" var="param">
<apex:dataTable value="{!map[param]}" var="opp" width="100%" align="left">
<apex:column >
 <apex:outputText value="{0, number, $#,###.00}"> <apex:param value="{!opp.Amount}" /> </apex:outputText>


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


Does anybody know why the amount cannot be displayed formatted? {!map} is a Map<String, List<Opportunity>>

It doesn't work for a date, too.



Maybe it's because a map cannot remember datatypes so every field of the opportunity is a String if you access it in Visualforce?!?


Ok, but the formatting still doesn't work...


<apex:column value="{0, number, $#,###.00}" >
      <apex:param value="{!opp.Amount}" /> 

 The code above generates the following error message:


ErrorError: Formula expression is required for attribute value in <apex:column>
Ankit AroraAnkit Arora

Try this :


<apex:column value="{!opp.Amount}" />



Ankit Arora

Blog | Facebook | Blog Page


Ankit, thank you for your help, but my problem is the formatting. I want to format the amount!

If I use your solution, I cannot format the amount. Is there a solution where I am able to format the amount?

Greg RohmanGreg Rohman

I'm experiencing a similar issue when attempting to format a map value. My VF code is as follows:


<apex:outputText value="{0,number,$###,###}"><apex:param value="{!expenseTotals['2008']}"/></apex:outputText>

public Map<String,Decimal> getExpenseTotals() { 
Map<String,Decimal> annExpenseTot = new Map<String,Decimal>();
return annExpenseTot;

 The error in the IDE is 


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



Please advise as to a solution, as this appears to be a bug.




The only thing that works for me so far is writing a wrapper class with string fields... But obviously I don't want to write a wrapper class all the time... Can I report that bug to the support team directly?

Guy Bickel 1Guy Bickel 1
I know this is a really old post, but I was having a similar problem.  You can get a decimal formatted as a currency if you nest a outputText inside of the column:
<apex:column headerValue="Moola">
  <apex:outputText value="{0, number, $###,###.00}">
    <apex:param value="{!myMoneyField}"/>

Hope this helps anyone else searching for this solution...