We can use SSRS (SqlServerReportingServices) to generare reports. Once I had a requirement to generate reports to be shown based on the parameter value passed. The requirement is as below.
The report consists of taxi/train records. The Client may pass taxi or train as parameter to filter and get the record. This can be done either in database or when designing the report. If it has to be done when designing the report, let us consider the below table in the report
Assuming we have a report designed as below
<table width="100%">
<tr>
<td style="background-color: #6600FF">Mode</td>
<td class="style1">From</td>
<td class="style1">to</td>
<td class="style1">Timw</td>
<td class="style1">Remarks</td>
</tr>
<tr>
<td>Train</td>
<td>Delhi</td>
<td>mumbai</td>
<td>10AM</td>
<td>to be booked</td>
</tr>
<tr>
<td>Taxi</td>
<td>Marthahalli</td>
<td>BTM</td>
<td>9AM</td>
<td></td>
</tr>
<tr>
<td>Train</td>
<td>Blore</td>
<td>Chennai</td>
<td>5PM</td>
<td></td>
</tr>
<tr>
<td>Taxi</td>
<td>Station</td>
<td>Home</td>
<td>3PM</td>
<td></td>
</tr>
<tr>
<td>Train</td>
<td>Ooty</td>
<td>KodaiKanal</td>
<td>3PM</td>
<td></td>
</tr>
</table>
The above report has 2 rows (one will show train/bus details) and the other will show taxi
details.
I will give input parameter to show all the details or only taxi details or to show only
train/bus details.
I will pass the parameter as below for variable param.
Param should be either All/Train/Taxi
Now based on the parameter value I need to display/hide the row. Right click on the row (train/bus details) -> properties -> visibility -> expression
Now give validation in expression as
=IIF(Parameters!Param = "All" or Parameters!Param = "Train",False,True)
By setting the above expression, the row will be made visible only when the property is
either All or Train.
For the second row, go to the visibility property and set the expression as
=IIF(Parameters!Param = "All" or Parameters!Param = "Taxi",False,True)
By setting the above expression, the row will be made visible only when the property is either All or Taxi