Format Ints with commas?

  • Has anyone figured out how to take a field that produces an INT and format it with commas every three digits?

    I.E., I have a field called MyField which can produce anything from a -2 to 2205138. The end user wants anything that's above 3 digits (either in the negatives or positives) to show commas. So 2205138 becomes 2,205,138.

    Any thoughts on how I can format the field on the SSRS side?

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • Brandie,

    right-click on the textbox which contains your values and select properties. Go to the Format tab and in the field "Format code" enter the value "#,#".

    This will format the values the way you want.

    [font="Verdana"]Markus Bohse[/font]

  • Thanks, Markus! Worked like a charm. @=)

    Is there a weblink or a BOL topic that I can search to see all the different types of format codes one can use in SSRS?

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • Sorry but I can't help you with this. I found the documentation in BOL not that good when it comes to formatting options. What I did a lot was looking into other reports like the SSMS reports and see how things are handled in those.

    [font="Verdana"]Markus Bohse[/font]

  • Markus,

    What topic did you search in BOL to find the above? I couldn't find it no matter what I tried.

    Thanks,

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • Actually I didn't look in BOL.

    I have a short list of Tips & Tricks I often use in reports, and that's just one of them.

    [font="Verdana"]Markus Bohse[/font]

  • FOUND IT! @=)

    Markus (and anyone else looking for this information):

    Check out the following links for code to use the Properties->Format->Format Code box of a text box:

    Custom formatting: http://msdn2.microsoft.com/en-us/library/7x5bacwt(VS.71).aspx

    Standard formatting: http://msdn2.microsoft.com/en-us/library/dwhawy9k(VS.71).aspx

    And to do both negatives & commas, use: #,#;(#,#)

    Hope this helps someone out in the future.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • Those links are awesome. I use the experiment method where I try everything under the sun and finally give up, then ask someone else. Thanks guys.

  • I'm glad someone found them useful. @=)

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • Brandie and Markus,

    I second the Thanks! Thanks! I have just begun to work with SSRS in SQL Server 2005. I have used Crystal Reports for quite a few years.

    "Key"
    MCITP: DBA, MCSE, MCTS: SQL 2005, OCP

  • Here are some other links that may be helpful.

    Expression examples: http://msdn2.microsoft.com/en-us/library/ms157328.aspx

    Function Definitions: http://msdn2.microsoft.com/en-us/library/c157t28f(vs.71).aspx

    Best Practices for reporting:

    http://www.ssw.com.au/ssw/Standards/Rules/RulesToBetterSQLReportingServices.aspx

    http://msdn2.microsoft.com/en-us/library/bb395166.aspx

    [font="Comic Sans MS"]toolman[/font]
    [font="Arial Narrow"]Numbers 6:24-26[/font]

Viewing 11 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic. Login to reply