Jatin
Jatin

Reputation: 4063

Hide (Or Filter) some Columns of Columns Group

I am using a Report Builder 3 Matrix and specifying Row Groups and Column Groups. Basically its a master detail type situation, where in my case the Entities are Relays and Contacts. Each relay has multiple contacts. A few important properties of both are given below.

Relay:
Name (simple field),
Type (Enum Field),
Contacts (navigation field to Contacts Entity. One to Many)

Contacts:
DisplayName (simple field)
AllotedToSheet (simple field).

Here is how the report looks like. The Columns are generated from "Display Name" field of Contacts table using Column Groupings.

Generated Report Sample

Now here is the issue. I have marked 2 regions in the Report above. That is the case because I have two types of Relays (say for now). The "Display Name" fields of Contacts table are same for a particular relay type, so I get two sets of columns (as marked) in my report. Based on the Relay Type, I want to Generate or Show only one set of columns for the entire report because the other set does not make sense for Relay Type and Each Relay Type will have its own generated report (rdl). So how do I achieve this.

In summary, for columns generated using Column Groups, how to I filter out or hide certain columns from the report based on some database field.value condition

Edit: Report Designer View enter image description here

Upvotes: 2

Views: 6543

Answers (3)

Jatin
Jatin

Reputation: 4063

Inspired by @glh's suggestion to modify the DataSet Query directly, I was able to generate only the records (in my case columns) that were relevant to a particular Relay_Type. In the Query, I just had to add a SQL WHERE clause which would load details records of only a particular Relay_Type. This way the only columns that were relevant for a particular Relay_Type were generated by the Query in the DataSet. So there was no need to change the visibility expression to hide the Columns. In fact, Visibility expression didn't hide the columns, it just "Blanked it Out" taking space in the report. So modifying SQL seems to be better option for my case.

Nirvan.

Upvotes: 0

glh
glh

Reputation: 4972

I think it's best you link the tables via a join in the SQL. This will remove the extra columns being populated in the dataset.

Upvotes: 1

Ian Preston
Ian Preston

Reputation: 39566

Have you tried setting the Column Visibility to be expression based?

enter image description here

enter image description here

Set the expression to something like:

=IIf(Fields!RelayType.Value = "Relay1", false, true)

Updating as required for different relay/column combinations.

Upvotes: 2

Related Questions