locked
filtering Report RRS feed

  • Question

  • User-295641864 posted

    Hi ,

    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.

     

    Thanks

    Tuesday, March 20, 2012 11:07 AM

Answers

  • User2105670541 posted

    try:

    =IIf(Parameters!OpsName.Value.ToString().Contains("Central"),Field!YourOPSFieldName.Value,Parameters!OpsName.Value )
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, March 22, 2012 10:53 AM

All replies

  • User2105670541 posted

    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:

    http://stackoverflow.com/questions/6185390/passing-parameter-ot-rdl-report-for-asp-net

    Tuesday, March 20, 2012 12:07 PM
  • User-295641864 posted

    Hey Ashutosh,

     

    Thanks man.

    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

    Thursday, March 22, 2012 7:10 AM
  • User2105670541 posted

    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.

    Thursday, March 22, 2012 7:46 AM
  • User-295641864 posted

    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....

    Thursday, March 22, 2012 9:07 AM
  • User2105670541 posted

    try:

    =IIf(Parameters!OpsName.Value.ToString().Contains("Central"),Field!YourOPSFieldName.Value,Parameters!OpsName.Value )
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, March 22, 2012 10:53 AM
  • User-295641864 posted

    HEY Ashutosh,

     

    Thanks man , it worked like a charm. Your a life saver thanks a mil....

     

    Best regards

    Manoj

    Friday, March 23, 2012 3:23 AM
  • User2105670541 posted

    i'm glad ur code is working. :)

    Friday, March 23, 2012 3:53 AM