Sandeep Khandelwal's Blog

SharePoint, ASP.net & other related stuffs

SSRS 2008 Show/Hide Image in Table

clock August 24, 2009 05:45 by author Sandeep Khandelwal

Lets face it, we all have had our challenges with Reporting Services 2008. But recently I came across something that I would have thought should be really easy to do. And believe it or not, it is, but the problem is the IDE has a bug which hides the intuitive behavior for us.

Q. How do you show/hide an image in a table cell (textbox) based on some value in the database (or dataSet)? An eg. is a report based on stock prices. When a stock goes up, show the green arrow, stock goes down, show the red arrow.

A. There are few steps involved in accomplishing this. Step 1 is to draw the table ofcourse!. Step 2 is to throw 2 images (the images that you want to shift based on db values. Lets assume for the sake of this writing, we call them red_arrow and green_arrow. So, when the stock price change is in postive number, we want to show green arrow and when there is decline in stock price, we want to show a red arrow. So far so good. Now, in order to the rdl to know which two images that you are planning to use, drop 2 image controls from toolbox into the rdl and give them name as red_arrow and green_arrow. Also, make sure that you set the visible properties of these 2 images to hide.

Now, click on your table cell where you want these images to rotate, drop an image control there. Right click, go to Image properties and under 'Use this Image', you can actually use a function (FX). Click on Fx which should open up the selection window. Here is where the big gotchas/bug in Visual studio is. When you have a regular texbox, you have access to fields in dataset. But when you drop images, the fields in datasets are missing  (see image below).

In order to overcome this technical challenge, simply assume that you have access to field values there and hand-type your IIF syntax. Something like this.

=IIF(Fields!LTP_CHANGE.Value < 0, "red_arrow", "green_arrow")

You will see those red squiggly lines indicating a syntax error, but just ignore that for now.

Try and preview your report,it should show you correct images, based on your delta values. Thats it!

  

Currently rated 3.0 by 5 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


ItemUpdating Event and ItemUpdated Event & Require Check Out option

clock August 20, 2009 04:36 by author Sandeep Khandelwal

I just ran into this on my development and realize that I should share this anamoly with you. When you have a require check out option enable for the document library, you will experience an odd behaviour with the events actually firing twice. This is because how SharePoint object model handles the check-in and check out. Instead of me going on and on about how this happens and why this happens, here is a link to Microsoft KB article which explains clearly the behavior and its work-around. I followed the steps and looked for vti_sourcecontrolcheckedoutby in my code. If exists, then you have a valid check out if not, then ignore what you were planning to do with the ItemUpdating and ItemUpdated event. Simple...

http://support.microsoft.com/kb/939307 

 

Currently rated 3.0 by 5 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


About the author

I work as SharePoint Consultant and Lead ECM Solution Expert for Integration Now (a pioneer in SharePoint solutions in midwest region). Besides having PMP, MCP, MCTS and other technical certifications, I am also an MBA (Finance) from UMKC. I lead & oversee SharePoint engagements in 4 states around Kansas City (MO, KS, IA, & NE).

Tag cloud

Page List

Sign in