Wise Owl Answers - How do I hide columns using parameters in SSRS

Wise Owl Answers - How do I hide columns using parameters in SSRS This question popped up on a video about how to create drop-down list parameters in reporting services and what philip wanted to know was how to use parameters to control the visibility of columns in.

Wise Owl Answers - How do I hide columns using parameters in SSRS

A table so we've got several different ways we can do that i've created a quick basic report just to demonstrate the three techniques we're going to look at in this video.

So technique number one actually doesn't rely on parameters at all so this blue table up at the top here can be controlled just by clicking on text boxes in the report page so i click the.

Toggle runtime text box that hides the runtime column in the table and clicking the same text box again brings it back we can use a single text box to control multiple columns at the same time so i.

Can toggle both the budget and box office columns and i can use any combination of columns i like by clicking the individual toggle buttons now as well as using basic text boxes i.

Guess the disadvantage of this is that it occupies space on the report page we can also use a different set of parameters so here at the top left hand corner i've got some true false boolean.

Parameters to toggle the individual columns and combinations of columns so when i select some options here i then have to hit the view report button to control the columns visible in the.

Middle table on the report page again i can bring those back quite happily by changing the options and then viewing the report again finally i've got a single parameter.

Solution here with a drop down list that allows me to select multiple values so once again i can choose the options i want to see in my table this time so i'm going to go for the release date and the.

Money columns and viewing the report will affect the third table in the list and of course i can bring everything back again and then hit view report so we'll have a quick look at how to make.

All those three options work starting with the basic text box toggle system so i've created the basic report that we'll need i've got a data source pointing to our standard movies database.

And then a data set which shows the five most successful films based on oscar wins just in case you want to use the same data set that i'm using here that's the.

Posts Related:

    Query that i've created

    But it doesn't really matter what data set you choose to use for this video as long as you can create a table that contains a few columns you can choose to.

    Show and hide so i created one version of that table and applied some basic formatting to it and then copied and pasted it twice changed a bit of basic formatting so.

    That we can demonstrate the three different techniques in three different tables so at the moment if i run the report that's the output you should see we'll start by looking at how to hide a.

    Column in a table manually this is mainly so that i can show you how to control whether when you hide a column it keeps the space occupied by the column or whether that space is.

    Collapsed so we'll deal with the release date column in the first table in the report page let's head back to the design view and the first thing i'll do is click.

    Into any cell in the table and then click on the little gray box at the top of the release date column to select all the cells in that column now i'm going to use the properties.

    Window on the right hand side if i scroll all the way down to the very bottom we should find the hidden property sitting down there so it's set to false at the moment which.

    Means it's not hidden it's visible if i set the hidden property to true and then run the report again we can see that this time indeed all the cells in that column are no longer visible but you can.

    See the space occupied by the column by all those cells is still there it's still rendered i think that looks a little odd personally i prefer to collapse the.

    White space when i hide a column so to

    Demonstrate how that works let's head back to the design view and i'm going to select the same column again in the table and i'm going to change the hidden.

    Property back to false so it becomes visible again so back to normal now back in the design view i don't want to select the physical cells in the.

    Table i want to select the group or the column group that's associated with those cells in the table now at the moment in the groups panel i can't actually see the.

    Item that i need to select so you'll need to switch the grouping panel into advanced mode using this tiny little drop down arrow in the top right hand corner there so i need to click on that.

    And choose advanced mode and then you can hopefully see that each column each physical column in the table object has a corresponding static item sitting in the groups panel.

    So if i select the individual static items you can see that it selects the corresponding cell associated with that column in the table at the top so i've selected the static item that.

    Corresponds to the release date column and hopefully again you can see over here in the properties window that we've got a hidden property it's currently set to false so i'm going.

    To change that and set it to true and then if i run the report again we should see that the column is now no longer visible and it's also collapsed the space taken up by that table group.

    Next i'd like to be able to change the value of the hidden property for that static column group by clicking on a physical text box sitting on the report page.

    So back in the design view i'm going to select the static column item corresponding to the release date column and then i'm going to set its hidden property back to false so that when i.

    Run the report the released column will be visible now you'll notice the property sitting immediately below hidden there says toggle item.

    That allows me to refer to any text box in the report that i can then click on to toggle the visibility or the hidden property i should say so let's draw a basic text box i'll.

    Position it roughly above the release date column i'll let you deal with a nicer formatting i'll just add a basic text box and i'll type in some some simple text.

    Let's say toggle date or something along those lines i'll just apply some very basic formatting to it maybe maybe just change the font i'll actually be able to read.

    What i've typed in and switch it back and then if i just change the background color there i also want to modify the name of the uh the text box to make it easier to.

    Reference in a moment so with the text box selected i can find its name property in the properties window text box 22 is a pretty rubbish name let's call this one something like release.

    Date toggle names can't have spaces in them so make sure you don't type in any spaces when you change the name of your text box okay so at the moment if i run the.

    Report i've just got the basic text box sitting above the release date column now heading back to the design view i'm going to select any cell in that table highlight the static column group item.

    That corresponds to the column in the table find the toggle item property and then change the toggle item property to the.

    Thing i've just created so that was called release date toggle sitting all the way down there at the bottom of the list so now that i've done that i can run the.

    Report and we'll see that that text box gains a little plus symbol if i click the plus symbol you'll see that that hides the release 8 column it switches the plus symbol to a minus.

    Symbol i can then click on the minus symbol to bring the release date column back now if you think that properly is working the wrong way round we can.

    Easily flip that so that when the text box first appears it shows the minus symbol instead let's head back to the design view and i'll select my text box i'm going to head down towards the.

    Bottom of the properties window and find the initial toggle state property so it's the second one from the bottom there so it's currently set to false i'm going to set that one to true instead.

    And then if i run the report again you can see the text box has a minus symbol in by default if i click on the minus symbol it hides the column and switches to a plus and then i can click it again.

    To bring the release date column back you can use a single text box to control the visibility of multiple columns so let's create a toggle for the budget and box office columns i'm going to head.

    Back to the design view and then i'm going to just copy and paste the existing text box actually let's just quickly select and then copy and paste it and then i'll change the text in that.

    Text box to say something like toggle money and then of course i want to change its name so it's easy to identify let's call this one money toggle.

    And then get rid of the number two at the end and then selecting the table that i want to toggle the visibility of its columns of i need to select i need to identify.

    DISCLAIMER: In this description contains affiliate links, which means that if you click on one of the product links, I'll receive a small commission. This helps support the channel and allows us to continuetomake videos like this. All Content Responsibility lies with the Channel Producer. For Download, see The Author's channel. The content of this Post was transcribed from the Channel: https://www.youtube.com/watch?v=tgWn6hLIEsw
Previous Post Next Post