Friday, April 27, 2007

Save the Bees!

I have been listening to testimony on Cap Hill about colony collapse disorder (CCD) - Very scary stuff. I have been following this story intently for several months because of the time I spent with a friend in his apiary business. He has lost 1/3 of his bees lately and this is going to severely affect our food supply. Someone should figure out a way to preserve their genetic material in case we find a way to use it later.

One of several things will happen:
1. All the bees will all die off, 75% of the world's population will starve, war will break out over the food that is left, the few people that survive will barely be subsisting and not be contributing to the global warming any more, and a new species of insect will take the place of the bees.
2. The bees that do survive CCD will have superior genetic material, their honey will be prized and, thanks to short sighted entrepreneurs, all their honey will be sold to the Chinese for $100/oz which will leave nothing for them to live thru the winter on, and they will die - see scenario #1
3. Similar to #2 except that the bees with superior genetic makeup will create "super" bees with "hive intelligence." They will start their own government, sell the royal jelly to the Chinese as an aphrodisiac for $15000 per oz, buy up all the world's assets under an assumed name and force all mankind to live in the outback of Australia to act out the "Road Warrior" (a Mel Gibson movie) for their entertainment.

Wednesday, April 25, 2007

Formatting number fields

I have been setting up many reports for a MS CRM system using SSRS and there are a multitude of places where numeric and dollar amounts are being printed. I could just use one of the standard formatting codes provided by SSRS, but then if the customer changes their settings in CRM, it will not be reflected in the custom reports.

I realized today that there is a database function (found under the Programmability/Functions/Table-valued Functions) available to me in CRM called fn_GetFormatStrings() that returns most of the number formats I would need. The function returns a single record (you query it in SSRS like it was a table) and each field contains the number formatting string. Each field is named something appropriate, such as "NumberFormat_2_Precision" and the string looks like this: "###,###,###,##0.00;-###,###,###,##0.00;0.00". So to make use of that, we have created a query in the RDL called DSNumberFormat that pulls that one record and then in the Format for that textbox, we make a reference to that using the expression
=First(Fields!NumberFormat_2_Precision,"DSNumberFormat")

Tuesday, April 24, 2007

A Modest Beginning

All good things must begin somewhere. My journey in a computer career started by trying something new, and it has been somthing new every day ever since. This blog is the most recent example.

Last year a client asked me to develop some reports for MS CRM using SQL Server Reporting Services (SSRS). I have decided to post some of the things I have learned here so that others may benefit from this useful (although quirky) tool.