Displaying an Integer column without separating commas - while maintaining sorting as an integer

(3 posts) (2 voices)
  1. shem, Member

    I retrieve a column from the database - for example a column named days_since_sale_date
    I want it to display without commas (i.e. 2134 instead of 2,134)
    By default mydbr seems to display all integer columns with comma separators.
    How can I do this in such a way that when I click on the column header in the report output it will sort the column as integers (and not changed to strings).

    So when I tried the following
    select CAST(days_since_sale_date AS CHAR) as 'days_old

    it displayed all the values without commas however it treated all the values as strings.
    Thus when I clicked on the column header, it would display in this order
    2134
    345
    478

    I want the order when I click on column header to be
    345
    478
    2134
    but without commas

  2. myDBR Team, Key Master

    If you convert an integer to a character string, the column will be treated as a character column.

    The number formatting is, by default, determined by the user/system preferences (decimal separator and thousand separator). If you wish to display a number without any formatting, set the column style (printf formatting) as '%d'.

    select days_since_sale_date as 'days_old';
    
    select 'dbr.colstyle', 'days_old', '%d';

    --
    myDBR Team

  3. shem, Member

    Thank you


Reply

You must log in to post.