View Issue Details

IDProjectCategoryView StatusLast Update
0003867JEDI VCL00 JVCL Componentspublic2006-09-01 02:57
ReporterConnectedTextAssigned Toobones 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.20 
Target VersionFixed in Version3.30 
Summary0003867: Sorting in JvListView.
DescriptionI have a small suggestion for JvListView.

If you add values with thousand separators to columns they are not ordered
correctly, even if you set to smNumeric or smCurrency. The problem lies
in the fact that StrToFloat do not accept thousand separators. To fix it is
only necessary to remove the thousand separator prior the conversion to
float in IsBigger function. It also makes function faster since no more
exceptions are raised when strings contains thousand separator.

            smNumeric:
              begin
                try
-> First := StrRemoveChars(First, [ThousandSeparator]);
-> Second := StrRemoveChars(Second, [ThousandSeparator]);

                  I := StrToFloat(First);
                  J := StrToFloat(Second);
                  Result := I > J;
                except
                  try
                    l := StrToInt64(First);
                  except
                    l := 0;
                  end;
                  try
                    m := StrToInt64(Second);
                  except
                    m := 0;
                  end;
                  Result := l > m;
                end;
              end;

The same is necessary in smCurrency case.
TagsNo tags attached.

Activities

obones

2006-08-30 08:02

administrator   ~0010050

I'd rather use VarCyFromStr (see issue 0003494) to get the currency from a "locale" formatted value.
VarR8FromStr seems another good candidate for the conversion from string to float :

http://msdn.microsoft.com/library/en-us/automat/html/789b770a-2b8b-45b2-a572-73c207d31e3e.asp

ConnectedText

2006-08-30 11:02

reporter   ~0010051

Last edited: 2006-08-30 11:03

I think VarCyFromStr could be used for the Currency case. I assume Numeric case applies only to strings with decimal and thousand separators. But any workable solution is welcome.

Issue History

Date Modified Username Field Change
2006-08-22 11:07 ConnectedText New Issue
2006-08-30 08:02 obones Note Added: 0010050
2006-08-30 08:02 obones Status new => feedback
2006-08-30 11:02 ConnectedText Note Added: 0010051
2006-08-30 11:03 ConnectedText Note Edited: 0010051
2006-09-01 02:57 obones Status feedback => resolved
2006-09-01 02:57 obones Fixed in Version => Daily / SVN
2006-09-01 02:57 obones Resolution open => fixed
2006-09-01 02:57 obones Assigned To => obones