Skip to Content

Populating the list of values for a Dynamic Cascading Parameter through .NET

Folks, I know this has been tossed around bit before - but I didn't quite find the solution in my digging around, so I'm going to present the case again…

First, let me explain a little of my architecture which gives rise to some limitations. I have a .NET MVC web application for client case management (housing and homelessness). The web application has no access to an database – instead there is a separate application, .NET WCF application that hosts a series of services for interaction with the data layer. Nothing crazy, just lost of CRUD methods… The web application EXCLUSIVELY uses these web services.

Now, users want to develop their own custom reports so we settled on Crystal Reports – they buy a copy of the full version to build their own reports (they have sample database to build reports against). We have a reporting module in the application where they upload the RPT to the system and then users can run that report and see it in the web viewer.

Now – in light of our architecture – you may already have raised your eyebrow… let me explain…

When a user runs a report – from the web application we call a method on a web service that in WCF application that creates a CrystalDecisions.CrystalReports.Engine.ReportDocument and loads the RPT. We then iterate through the ParameterFields and build a custom collection of parameter details that we pass back to the web application. This collection is used to show a view to the user where we fill in all of the report parameters – dates, booleans, strings, etc. We have some special dropdown lists that we can present to the user if they name and define a parameter according to a specification that we provide – in this way they get a dropdown filled with values that are relevant to their logged in user (e.g.: it filters out options they don’t have rights to see). They way this works is you define a simple number parameter in the report, but we show a dropdown in the web page where we collect the parameters, then we set the parameter value on the post back. Great so far – all of this works fine. We post the parameters back to the web application – it then calls another web service with the parameter values, the web service spins up that ReportDocument again, populates the parameters, and runs the report (ExportToStream) which we package up and return through WCF to the web application. It loads it into a local instance of ReportDocument and we show it in the viewer.

Now I am adding support for list of values defined in the report – which was no trouble for static parameters. The problem is with the dynamic lists. My web application has no access to the database – that is the domain of the web services. So I can’t rely on the Crystal Reports Viewer generated parameter dialogues to display values – it can’t access the database to query for the values. I can always fall back on my gimmick of prescribing parameter definitions to my users and then coding a special case in my parameters view to show them a dynamically generated list of values – but obviously this limits them to only using dropdowns that I support, and it puts the burden on me to code up additional support every time someone dreams up a new report where they need to pick something from a dynamic list. What I want to do is ask Crystal to refresh those dynamic lists of values in the ReportDocument object inside the WCF service where the database is in scope – but there does not appear to be any method to make this happen. The only time I ever see Crystal query for a dynamic list of values is when it wants to show its own parameter dialogue in the designer preview or in a web viewer where the database is accessible.


Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Sep 06, 2017 at 04:07 PM

    Hi Jason,

    On the download page I created and app and attached it called:


    WIKI page:

    In there there is a drop down list box to get parameters. It will check the Param type and then if it is a LOV it will query the DB to get the list, requires being logged on first.

    You should be able to do the same in one of your services that does have access to the DB.


    Add comment
    10|10000 characters needed characters exceeded