Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

StrToInt

edited August 2005 in General
Hi,
I have a field on a table by which I want to sort.
Its a string field.
However it's a list of numbers.
So on the report its sorted like this
1,10,11,100,2,20,3,4,40,5,etc.

How do I use the StrToInt command (or another command or tool) to make it
sort like a list of numbers?

Thanks
Redmond

Comments

  • edited August 2005
    Hi Redmond,

    ReportBuilder does not do any sorting on its own. All sorting is done
    either in the dataset query or in an in-memory object such as a TStringList.
    In order to sort this string field as you need, you may need to first move
    the data to another dataset such as an in-memory dataset or perhaps creating
    a sorting field A-Z.. etc. that sorts the string list that way. You could
    also copy all the strings into a TStringList, sort those, then using a
    JITPipeline add them to the report.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2005
    Am 30 Aug 2005 11:08:36 -0500 schrieb Red:


    If it is your table you could add afield of number type and fill it with
    the integer representation of the string-field.
    Otherwise you could use a TClientDataset and add a InternalCalc-field and
    fill it with the integer representation of the string-field in OnAfterOpen
    for each record.

    --
    Best regards
    Dietmar Brueckmann
This discussion has been closed.