You need to sign in to do that
Don't have an account?
baller4life7
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> </apex:column> </apex:dataTable> </apex:repeat>
Error: 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?!?
I recently faced the same issue, please visit : http://forceguru.blogspot.com/2011/07/binding-values-of-map-on-visualforce.html
http://boards.developerforce.com/t5/Apex-Code-Development/Error-OutputField-can-only-be-used-with-SObject-fields/td-p/302505
Thanks
Ankit Arora
Blog | Facebook | Blog Page
Ok, but the formatting still doesn't work...
The code above generates the following error message:
Try this :
Thanks
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?
I'm experiencing a similar issue when attempting to format a map value. My VF code is as follows:
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.
-Greg
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 Salesforce.com support team directly?
Hope this helps anyone else searching for this solution...