RE: Ordering string represntations of numbers

From: McDaniel, Joe R. (mcdanij..igr.org)
Date: Mon Jul 26 2004 - 16:24:48 EDT

  • Next message: Andrus Adamchik: "Re: Ordering string represntations of numbers"

    One way is to load into a List and create a Comparator that will do
    this.

    Another way (on the database) side is to use either a function to
    right-justify the string (pad left with spaces as in ' 16' and take
    the last n (say 6) characters to get ' 16') or use a function (if
    available) to convert to numeric.

    Best,

    Joe

    -----Original Message-----
    From: McBrayer, Roy [mailto:Roy.McBraye..ail.va.gov]
    Sent: Monday, July 26, 2004 3:21 PM
    To: cayenne-use..bjectstyle.org
    Subject: Ordering string represntations of numbers

    Is there a way to order a query of a varchar field that actually
    represents
    numbers in a similar fashion to using the toNumber function in SQL?

    Right now, as expected, 16 is ordered before 2 since I am dealing with
    Varchars.

    Thanks,
    Roy



    This archive was generated by hypermail 2.0.0 : Mon Jul 26 2004 - 16:25:08 EDT