Tuesday, 3 March 2015

Parametrized report using Department Table




  • In the Existing solution add a new report with the name "DeptReport".
  • Right click on Parameters.
  •  Select "Add Parameters.." then "Report Parameter Properties" will open.
  • Give the required names (Highlighted in the above screen). Then click on "OK" button.
  • Create "Data Source" and "Dataset". While dataset creation use Dept table instead of Employee table.
    • Query: 
      • SELECT        DEPT_ID, Name, Location
        FROM            DEPT
        WHERE DEPT_ID IN (@DEPT_ID) 
  • Go to "Parameters" selection and click on expressions (Highlighted in the below screen).
  • Then "Expression" window will open. Write the below expression
    • =IIF(Parameters!DEPT_ID.Value="",-1,Split(Parameters!DEPT_ID.Value,","))
  • Then after click on "OK" button.
  • In designer window insert a table and map the columns.
  • Click on "Preview" and pass the variable values and then click on "View Report" button. Then report will generate.


No comments:

Post a Comment