Adding a parameter to a report that is not coming from the stored procedure

  • Hi

    I am using RS 2000. I have a report that is connected to a store procedure, but I want to add a parameter called 'Show Expenses' and this will have an option of Y or N. Now if Y and a column in the sp called Item Type has  2 in it, those rows should be displayed in the report along with the rest of the returned data. If N is selected then these same rows should not come through.

    I hope this makes sense, and if it does, is it possible to do?

    I would be thankful for any ideas

    Thanks

    Tracy.

     

     

  • Tracy,

    It is possible to conditionally hide rows based on their contents.

    Select the row you wish to hide / not hide and then go to the Properties area.  Under the Visibility property click the down arrow next to Hidden, then click on <Expression>.  This will open the Edit Expression dialog box.

    In there you need to type something like this.

    =Iif( @ShowExpenses = "Y" AND Fields!ItemType.Value = 2, false , true )

    If your not familiar with the mispelled if I'd do some reading on it.  In this case when @ShowExpenses = "Y" AND Fields!ItemType.Value =2 you set the Hidden property to false, otherwise its set to true

    You didn't specify what to do when @ShowExpenses <> "Y" or ItemType <> 2, so you may need to nest the Iif

    =Iif( ( @ShowExpenses = "Y" AND Fields!ItemType.Value = 2 ) OR

    (@ShowExpenses = "N" OR Fields!ItemType.Value <> 2 ) , false ,true)

     I'm not particularily fond of the syntax for these.. but with some practice its readable.

    Good luck

    Mike

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply