Last post Mar 23, 2012 03:53 AM by Ashutosh Pathak
Mar 20, 2012 11:07 AM|manojnmmu|LINK
We have a report server that is currently working fine. My latest project is to customise these reports as per operation. For example report "Headcount" ,operation A can only view this report with people assigned to operation A. The report currently puts
each person under the respective operation headings. So the Data is there for ALL opertions under the respective headings.
I know that the filter functionality works in the report envronement. But Is there a way that when a user logs in ,his opertaionID (which is available) is used in the report to filter the data...anyway to set this in the front end and send it to report server
to use it to filter the data already retrieved from the database. Please can someone help me out.....im using C# asp.net.
Mar 20, 2012 12:07 PM|Ashutosh Pathak|LINK
you should use reportparameters in your reportviewer page in your asp.net site.
you must have a filter parameter lets say [ParamOperation] in your report, that will be used to pick the data from the database based on the Operation passed.
now your should create ReportParameters object and pass the value of Operation Name(that will be picked from the logged in user Operation) and pass it to the reportviewer object, also you need to set the
visibility of this parameter to hidden so that user will not get any option to change this parameter(because it should get passed at the back side of user). this is it.
Technical code you can find at below URL:
Mar 22, 2012 07:10 AM|manojnmmu|LINK
Im a little confussed . By setting the paramaters in the front end,does this reference the Filters in the report or parameters in the report. Im asking this because my report does not have any parameters. I want to use filters in the reports. Thanks
Mar 22, 2012 07:46 AM|Ashutosh Pathak|LINK
i think you should create a parameter at your report and fetch the data from that parameter(i mean this should be the filtered criteria to get the data), and then you can set this parameter value from the asp.net or c# and make this parameter hidden, so
your report bypass asking the parameter portion and end user will get the data based on his operation or something.
Mar 22, 2012 09:07 AM|manojnmmu|LINK
Lovely thanks man it works... :) your a life saver.
One more Question I have added an if statment in the filter. But my problem is that if the operation is let say[central] then report must show all data. How do I set this up in the if statment. My code is below:
=IIf(Parameters!OpsName.Value like "Central","Central",Parameters!OpsName.Value )
If operation is central show all values....
Mar 22, 2012 10:53 AM|Ashutosh Pathak|LINK
Mar 23, 2012 03:23 AM|manojnmmu|LINK
Thanks man , it worked like a charm. Your a life saver thanks a mil....
Mar 23, 2012 03:53 AM|Ashutosh Pathak|LINK
i'm glad ur code is working. :)