Search This Blog

Saturday, 6 September 2014

Dynamically show/hide columns based on selected multi-valued parameter



Sometime, we have a long list of columns in our report that is required to show more information on report. But problems come to that point when we have to restrict only selected columns in export/print. We can achieve this by giving a multi-valued parameter to hide the selected columns on demand. Let’s start with following steps:
image-1
Step 1. Add a multiple values parameter in report.
Do not forget to check “Allow multiple values” option.
Refer image-1

Step 2. Specify list of column names
Image-2
that you want to include to hide on demand.
Refer Image-2













Step 3. Now select individual applicable column one by one
and open its Column Visibility option. Refer Image-3
Image-3






Step 4. Under each applicable column Visibility property, put a expression like following. Refer Image-4
Image-4








=Join(Parameters!p_column_name.Value,",").Contains("Employeeid")

To discuss above expression:
·        Join(Parameters!p_column_name.Value,",") will join all the selected parameter values delimited to a character (“,”) and will retrun a string
·        .Contains("Employeeid") will return true if the given input value exists in the string otherwise will retrun false.

You can DOWNLOAD A SAMPLE REPORT