Tuesday, August 16, 2011

The most undervalued StsMes() function

I found the ability to display small messages in the status bar to be very useful and employed it as a means of providing quick feedback to users.  Its something that requires a bit of training at first if they are not used to it but most people who have been surfing the web seemed to understand it.


Monday, August 15, 2011

Showing a count of items in the Console with SQL

At one point I needed to show a count of items in the console link provided.  To get there I used a format similar to the following and then mapped it accordingly:

"SELECT 'NAME', '(' + CONVERT(VARCHAR(4), COUNT(F.ITEMS)) + ') MY ITEMS' as Due,'',1 as Sort
   FROM TABLE
 UNION 
SELECT 'NAME', '(' + CONVERT(VARCHAR(4), COUNT(F.ITEMS)) + ') MY ITEM LIST TWO' as Due,'',2 as Sort
   FROM TABLE
Order by Sort"

'NAME' is the name of the console branch.
Obviously the convert to varchar is how I'm turning the numerical count into something textual to display.  The actual display with be (count) Name of branch item.  In this case, (#) My Items followed by (#) My Item List Two.

The Union adds the two queries together.  Order seems pretty self explanatory.  So it would look like this in the v9 console:

NAME
   (#) My Items
   (#) My Item List Two

Good for knowing something at a quick glance in the console, such as a number of records, pending tests, and so on.