Search code examples
c#asp.netreportstimulsoft

How to properly configure dependent variables from Business Objects in Stimulsoft reports?


I'm currently working on a report that makes use of dependent variables, but I can't seem to make it work properly. As an example, I'm using the Northwind database and creating Business Objects inside my ASP.NET MVC application, then loading a pre-designed .mrt file and feeding the BOs to it. Here's what I have done so far:

public ActionResult GetDependentVariablesSnapshot()
    {
        string reportFile = Server.MapPath("~/bin/DependentVariables.mrt");
        StiReport report = new StiReport();
        report.Load(reportFile);
        var reportBO = new DependentVariables();
        var BOs = new List<StiBusinessObjectData>();
        BOs.Add(new StiBusinessObjectData("", "DependentVariables", reportBO));
        report.RegBusinessObject(BOs);
        report.Dictionary.SynchronizeBusinessObjects();
        return StiMvcViewer.GetReportSnapshotResult(report);
    }

Here's my dictionary panel on the Designer application: https://i.sstatic.net/zAEZE.png

And here's the configuration for both variables (Category and Product): https://i.sstatic.net/dbT7H.png

I tested it and the Business Objects are correctly mapped, and the data is displayed. However, in the parameters form at the top of the report, while the "Category" select is correctly filled, the "Product" one shows all of the products, and it keeps the same even if I change the value of the "Category" select. I guess I might have misconfigured something, but I'm not sure what.


Solution

  • The Dependent variables feature does not work with Business Objects.