The Power Of The Placeholder

AID: 1690
  • Status: Published

6550 points

  • ByValentinoV
  • TypeTutorial
  • Posted on2009-10-04 at 05:34:21
The following little narrative will show you a new feature of SQL Server 2008 Reporting Services: support for rich-text.

Once upon a time in a Business Intelligence Development Studio 2005 Reporting Services solution there liveth a Textbox object which developers could use to put text on a report.  It was a fairly simple object, allowing only two ways of programming the text.

The first and most simple way of the two was to type plain and simple text directly into the box:
 
image01.png
  • 10 KB
  • SSRS Textbox with simple constant text
SSRS Textbox with simple constant text


And the second, more advanced way, alloweth developers to use an expression to create the text dynamically.  With this they could combine data from several sources into the same Textbox:
 
image02.png
  • 44 KB
  • SSRS Edit Expression window
SSRS Edit Expression window


Then developers realized that something was still missing.  Text could be created dynamically but they also wanted to optimize the way the text looketh.  So they selected part of the expression and tried to change some font properties.  But alas, they couldn't.  It was all or nothing:
 
image03.png
  • 9 KB
  • Text rendered using some font styles in SSRS 2005
Text rendered using some font styles in SSRS 2005


Then arriveth the day of the birth of the successor to BIDS 2005.  As the family's tradition went, it was called the same as its parent.  The only difference was its birth year: BIDS 2008.

And developers started exploring BIDS 2008 and discovereth that the Textbox object had gotten an upgrade.  When editing the content of the textbox, the right-click menu has gotten a new item:
 
image04.png
  • 9 KB
  • SSRS 2008 Create Placeholder menu item
SSRS 2008 Create Placeholder menu item


That's right, Create Placeholder.  And this was the moment in time when developers started to have fun again.  The placeholder can be given a value through an expression, just like the olden days:
 
image05.png
  • 55 KB
  • Placeholder Properties - General tab
Placeholder Properties - General tab


The Placeholder's value can be given a format through the Number tab:
 
image06.png
  • 78 KB
  • Placeholder Properties - Number tab
Placeholder Properties - Number tab


And a Placeholder's font can be customized:
 
image07.png
  • 82 KB
  • Placeholder Properties - Font tab
Placeholder Properties - Font tab


Now you may ask yourselves, wherein lies the difference with the olden days?

Well, it lies in the fact that several Placeholders and regular constant text can all be combined in the same Textbox!

This is what it looks like in Design time:
 
image08.png
  • 21 KB
  • SSRS 2008 textbox with placeholders
SSRS 2008 textbox with placeholders


And rendered in Preview:
 
image09.png
  • 11 KB
  • SSRS 2008 Preview of textbox content
SSRS 2008 Preview of textbox content


Powertip: to easily open up the properties of an existing Placeholder, single-click the Textbox to select it, again single-click to edit the content, then double-click a Placeholder to get its properties window.

When reports developed using BIDS 2005 are attached to a 2008 SSRS solution, any expressions in textboxes are acting as a placeholder as well:
 
image10.png
  • 15 KB
  • Textbox with expression converted to BIDS 2008
Textbox with expression converted to BIDS 2008


And developers liveth happily ever after.

Although not entirely.  Try entering a chemical formula in the textbox.  Indeed, there's no subscript option in the font settings.  And it doesn't work through HTML either, as explained in this Microsoft Connect bug report.  It's probably not as easy as it sounds, but if Word can do it I think so should SSRS.

A possible workaround for the subscript limitation is the following: if subscript is not possible, try putting the numbers in a smaller font than the other characters.  The workaround doesn't look as good as with subscript but better than just in regular font size.  At least, that's my opinion.  Here's a screenshot to show what it looks like when rendered that way:
 
image11.png
  • 1 KB
  • Workaround for subscript limitation: an example
Workaround for subscript limitation: an example



If you liked this article, please don't hesitate to hit that YES button down below.  And thank you for reading what I write!

Happy reporting,
Valentino.
    Asked On
    2009-10-04 at 05:34:21ID1690
    Tags

    SSRS

    ,

    SQL Server Reporting Services 2008

    ,

    rich-text

    ,

    placeholder

    Topic

    MS SQL Reporting

    Views
    4262

    Comments

    Expert Comment

    by: December2000 on 2012-03-19 at 11:54:52ID: 46905

    Awesome!

    Add your Comment

    Please Sign up or Log in to comment on this article.

    Join Experts Exchange Today

    Gain Access to all our Tech Resources

    Get personalized answers

    Ask unlimited questions

    Access Proven Solutions

    Search 3.2 million solutions

    Read In-Depth How-To Guides

    1000+ articles, demos, & tips

    Watch Step by Step Tutorials

    Learn direct from top tech pros

    And Much More!

    Your complete tech resource

    See Plans and Pricing

    30-day free trial. Register in 60 seconds.

    Loading Advertisement...

    Top SSRS SQL Reporting Svc Experts

    1. ValentinoV

      226,820

      Guru

      20 points yesterday

      Profile
      Rank: Genius
    2. huslayer

      108,772

      Master

      20 points yesterday

      Profile
      Rank: Sage
    3. TempDBA

      54,871

      Master

      0 points yesterday

      Profile
      Rank: Sage
    4. Nicobo

      37,600

      0 points yesterday

      Profile
      Rank: Wizard
    5. santhimurthyd

      36,656

      0 points yesterday

      Profile
      Rank: Wizard
    6. SThaya

      31,119

      0 points yesterday

      Profile
      Rank: Master
    7. planocz

      20,826

      0 points yesterday

      Profile
      Rank: Genius
    8. sammySeltzer

      19,700

      0 points yesterday

      Profile
      Rank: Genius
    9. harish_varghese

      18,800

      0 points yesterday

      Profile
      Rank: Master
    10. lcohan

      17,827

      0 points yesterday

      Profile
      Rank: Genius
    11. TimHumphries

      13,046

      0 points yesterday

      Profile
      Rank: Wizard
    12. EugeneZ

      12,950

      0 points yesterday

      Profile
      Rank: Genius
    13. dtodd

      11,600

      0 points yesterday

      Profile
      Rank: Genius
    14. jimhorn

      11,065

      0 points yesterday

      Profile
      Rank: Genius
    15. srikanthreddyn143

      9,900

      0 points yesterday

      Profile
      Rank: Guru
    16. jogos

      9,800

      0 points yesterday

      Profile
      Rank: Sage
    17. HainKurt

      9,732

      0 points yesterday

      Profile
      Rank: Genius
    18. mlmcc

      8,100

      0 points yesterday

      Profile
      Rank: Savant
    19. ScottPletcher

      7,500

      0 points yesterday

      Profile
      Rank: Genius
    20. mwvisa1

      6,501

      0 points yesterday

      Profile
      Rank: Genius
    21. CodeCruiser

      6,250

      0 points yesterday

      Profile
      Rank: Genius
    22. wdosanjos

      5,000

      0 points yesterday

      Profile
      Rank: Genius
    23. Emes

      4,750

      0 points yesterday

      Profile
      Rank: Wizard
    24. Buttercup1

      4,750

      0 points yesterday

      Profile
      Rank: Master
    25. mark_wills

      4,664

      0 points yesterday

      Profile
      Rank: Genius

    Hall Of Fame