Sunday, July 20, 2008

Plain Text !

Have you ever been annoyed by the fact that pasting items into Word or an Outlook E-Mail also copies in the formatting from the source? The only way around it is to do a paste special, unformatted text, which is an irritating mouse click exercise.

Well – I found this very cool and free utility at http://www.stevemiller.net/puretext. Just run this utility (No install program, just put the exe into a folder, and run it. Then you can tell it to "start with windows" by setting the options from the tray icon). From that point on using Windows-V (the windows key + v) instead of the normal paste shortcut of ctrl-v will paste plain unformatted text. Alleluia.

Now if only there were a Windows hot-key combination to automagically delete spam …

Thursday, June 26, 2008

Referencing Totals in Reporting Services

I had the common task of creating a Reporting Services report that showed sales along with the percentages of sales. Like this:


The trick was the grand total figure was not available until the report footer. In the past, I have attacked this problem by using SQL statements that provided the grand total with each line of detail. Doing it that way is OK until you start needing additional percentages - like percentage by region, country, and state. Then the SQL becomes more tricky and processor intensive.

I read about a better solution today in a forum post at databasejournal.com - the author's name was not in the post. They suggested naming the textbox that contains the total, and then referencing it in the formula that calculates the percentage. Brilliant! I had assumed that the total figure wouldn't be available until after the report had been processed. This is not the case, aparently. There is a pre-processing step that occurs in Reporting Services. Cool, lucky me!

I names the total text box "GrandTotal". So - now the formulas for the percentage columns can look like this:

=(Fields!Sales.Value / ReportItems!GrandTotal.Value)

Sweet.