Jump to content
Changes to the Jaspersoft community edition download ×

DataSoure / GetData Problem with InputControls


michael.kolowicz

Recommended Posts

I have create a wrapper for using Japser Server Reports in my own .NET application. The wrapper get the report via getWSClient.

My goal is to show the server input controls in my application to select the paramters of the report. It works fine until I have input controls they query data. Then the list of possible entries still empty.

My wrapper (a java-class) is following to determine the input controls:

            // Hier geht es um die Verwendung der InputControls            int parametersCount = 0;            logger.info("Open report definition on server");            List<ResourceDescriptor> iCtls = new ArrayList<ResourceDescriptor>();            List list = rpt.getChildren();            for (iCounter = 0; iCounter < list.size(); ++iCounter) {                ResourceDescriptor rd = (ResourceDescriptor) list.get(iCounter);                if (rd.getWsType()                        .equals(ResourceDescriptor.TYPE_INPUT_CONTROL)) {                    parametersCount ++;                                       // Umschreiben der ServerDataSource auf eine lokale DataSource, wenn es sich um eine                    // Query handelt                    List icList = rd.getChildren();                    for (icCounter = 0; icCounter < icList.size(); ++icCounter)                    {                       // MISSING PART TO GET DATA TO THE CONTROLL                    }                    // Hinzufügen in die Liste der InputControls                    iCtls.add(rd);                }            }[/code]

After this code i open it ReportUnitRunDialog of the iReport-Source to bring up a dialog with the control

                ReportUnitRunDialog dlg = new ReportUnitRunDialog(frame,                        true);                dlg.setInputControls(iCtls);                dlg.setVisible(true);[/code]

If the user select the parameters then i open the report with the selected values

                // Hinzufügen der InputControls zu den Parametern                Map<String, Object> params = dlg.getParametersValues();                for (ResourceDescriptor rd : iCtls) {                    for (Map.Entry<String, Object> entry : params.entrySet()) {                        if (entry.getKey() == rd.getName()) {                            reportData.parameters.put(rd.getName(), entry                                    .getValue().toString());                            logger.debug("Users Input : " + rd.getName()                                    + " = " + entry.getValue().toString());                        }                    }                   }[/code]

All this works fine - but I only need the missing part to fill the InputControl with the correct data.

A possible Idea is that my application set the properties of the connection to a ???-Object and put into the input control. Or another way could be that the wrapper try to get the needed data (I found helpfull properties like  PROP_REFERENCE_URI (the link to the DataSource on server) and PROP_QUERY (the Query that be used from the inputontrol to get data)

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...