Wednesday, September 7, 2011

SQL Reporting Service – Create An Application

Well, here I am again. I seem to be getting better at posting these days, and here's a fun one!

A few years ago, I had a customer that had a report that listed items in a catalog. At times, they would print out the report and manually scratch out items that needed to be removed from the catalog. I recognized what they were doing one day and suggested we build a web page for them to use to edit the items. Since they were so familiar with the report, I decided to try to embed a link that would remove the items from the database.
So, we added a parameter to the default page that accepted input and passed in the ProductID, which was then fed to a SQL Stored Procedure which deleted the item from the catalog. Below is the link we used to make the call to the we page.

="javascript:void('" & Fields!ProductID.Value & "', '_new'))"

Where does this go?

Right click on top of the text or field you want to link to the trigger the event, in our case a delete event. Select the Text Box Properties link, and goto the Action dialog. Select Go to URL from the radio button list and then click the function button next to the Select URL text box.

In the Expression text box, type in the javascript call and click Ok.


That's it. Have Fun!