3.0 beta 2

Problem in Sorting - When Using Currency Symbol

I am facing problem in sorting [only] when using currency symbol along with data/values;

Problem:
£10.5
£11.6
£5.6 (Without currency symbol, sorting works fine)
£6.3

But works fine for values;
£0.01
£0.02
£0.03

An urgent help in the above matter will be highly appreciated.
Fahad Hanif
November 14,
Values after sorting;
£10.5
£11.6
£5.6
£6.3 (Without currency symbol, sorting works fine)

Alex, could you please help!!!!!!!
Fahad Hanif
November 14,
Are you storing the information in the array as £11.6 or 11.6? I suggest that you store the information in numeric format then use a format statement to display it with the £.
That is what I would try. I have not tried it to solve your problem but I think it would hlp.
Jim Hunter
November 14,
This will work fine if the values use single currency symbol but if values are something like:

£10.5
$11.6
£5.6 (Without currency symbol, sorting works fine)
$6.3

I want to sort it by values, required result is:

£5.6
$6.3
£10.5
$11.6
Due to different currency symbol i cant use format statement.
Jim can u please give me the solution of this problem?
Shakir Parvez
November 15,
I tried to apply format statement but it didnt work.Is there any other idea?

var number = new Active.Formats.Number;
number.setTextFormat("$ #.##"); //not working
obj.setCellFormat(number, 4);

Sorting works fine on this column but no currency symbol with values.
Shakir Parvez
November 15,
Alex/Jim, Any help on the above problem. We need urgent help in the above matter to move forward with the AW2.0, as this issue is blocker and we are unable to implement AW in our reporting system along with the above "sorting problem when using currency symbol".

Looking forward for any workaround or tip!!
Fahad Hanif
November 15,
If you do a search of the forum, I think you will find mention of a technique to use a different column (hidden) to actually sort on even though you are clicking columnX. With that technique (or override the sort method, I think there is also a post about that) use the JavaScript function parseFloat to get just the numeric value out of your string. Here is a link to a page that tells you how to use parseFloat http://www.javascripter.net/faq/convert2.htm . I hope this will help you out.
Jim Hunter
November 15,
Fahad,

when you supply your data as text but want it to be sorted as numeric values - you have to provide both text AND values (or provide a function which converts text to numeric values):

obj.setCellText(myData);
obj.setCellValue(function(col, row){
    return parseFloat(myData[row][col].replace(/[^0-9.]/m, ""));
}, 2);


This code fixes sorting in /examples/old/basic.htm, Market Cap. column. The RegExp removes all non-digit characters (except ".") and parseFloat function converts the result to numeric value.

Alex (ActiveWidgets)
November 15,
Fahad/Shakir,

I've used the script below and works fine so far at my side:

obj.setCellValue(function(col, row){
return parseFloat(myData[row][col].replace(/[^0-9.]/m, ""));
}, columnNumber);
Navaid
November 17,
Alex,

Thanks for you help.

Highly appreciated!
Fahad Hanif
November 17,

This topic is archived.

See also:


Back to support forum

Search

Version 2

Looking for AW 2.6 ?
The old site is here.