This may be somewhat related to the old "Sorting Weirdness" thread, but it didn't provide a clear answer and I'm hoping I might be able to find a solution.
We are building a report from a custom object. One of our fields uses a float data type, and we need to be able to sort by that field.
#foreach( $object in $sorter.sort($list_cList, "Send_Date:desc")) |
Solved! Go to Solution.
Cause is clear, Double.compareTo() doesn’t have an overload for Integer.
Convert all the Integers to Doubles before sorting:
#foreach( $Campaign in $list_cList )
#set( $Campaign.Amount_Allocated_Percent_Change = $convert.toDouble($Campaign.Amount_Allocated_Percent_Change) )
#end
${number.format("${esc.h}.00",$Campaign.Amount_Allocated_Percent_Change)}
Cause is clear, Double.compareTo() doesn’t have an overload for Integer.
Convert all the Integers to Doubles before sorting:
#foreach( $Campaign in $list_cList )
#set( $Campaign.Amount_Allocated_Percent_Change = $convert.toDouble($Campaign.Amount_Allocated_Percent_Change) )
#end
This is great, thank you. One further question, the whole numbers only display with one decimal point (18 becomes 18.0) -- is there a quick method to ensure all numbers display with two decimal points?
Thank you -- as a new Marketo user (also new to VTL) your resources and your knowledge have been invaluable.
Happy to help.