Web Analytics Made Easy -
StatCounter Crystal Reports: Add/Remove Parameter Dynamically? - CodingForum


No announcement yet.

Crystal Reports: Add/Remove Parameter Dynamically?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Crystal Reports: Add/Remove Parameter Dynamically?


    After fighting with my first Crystal Report in VS2005, I've finally gotten it to (mostly) function when testing on our live server. However, I am having some difficulty with parameters. Here is my situation:

    I have two parameters defined in my crystal report ("dept" and "empID"). I have two corresponding DropDownLists that the user can select from to change the filter criteria (one is by Department, the other by Employee ID). The "default" selected item for these is "Show All". If "Show All" is selected in either DDL when they click "Generate Report", I want to display all departments/employees (depending on which was set to "Show All") in the report.

    The problem I am facing is when they select "Show All", I still have to set the "dept" and "empID" parameters equal to some value to filter upon, which means I cannot return all values to the report. For instance, if a user selects "Service Department" and leaves "Employee ID" set to "Show All", in my codebehind I set cryRpt.SetParameterValue("dept", deptDDL.SelectedValue) which will only show Service Dept records, but then I must also specify an Employee or the report will not give me results.

    How do I remove the "empID" parameter from the report at runtime so that it doesn't require me to filter by employee as well? Or is there a way to delete it from the report design and instead add it on the fly if they selected an employee?

    Also, I noticed the "RecordSelectionFormula" option......what exactly is this? Could I use this somehow to get the job done? I did some searches but I am not familiar with the syntax of this field.

    Thanks alot in advance to whoever can shed some light!