How to use cascading input control in web application

Hello All,

I'm trying to use cascading input control in my web application, but couldn't get any success till date. I have a web application which displays all the reports under an organization, and based on selection of input parameters, report is displayed. In one of the report, the input criteria is a cascading multi select query, as based on the selection of country in the first list box, list of states is to be displayed in the second list box.I saw a sample "Cascading multi select example report", which is actually same what I require for my application. The sample runs fine on the jasper server and ireport, but when I run the sample in my jsp/servlet based application, the countries are displayed, but how to get list of states on selection of country, or is it something I have to do it manually by querying the database. I'm using jasperreports-server-4.7.

 

private LinkedHashMap getSingleSelectInputControData(
            final ResourceDescriptor reportChild, final String dataSource)
            throws ReportingException {
        LinkedHashMap inputData = new LinkedHashMap();
        ResourceDescriptor inputControlDescriptor = new ResourceDescriptor();
        inputControlDescriptor.setUriString(reportChild.getUriString());
        inputControlDescriptor.setResourceProperty(
                ResourceDescriptor.PROP_QUERY_DATA, null);

        List inputControlArgs = new ArrayList();
        inputControlArgs.add(new Argument(Argument.IC_GET_QUERY_DATA,
                dataSource));
        // TODO: Check this if it works :
        // It was inputControlArgs.add(new Argument(Argument.RU_REF_URI,
        // resourceDescriptor.getUriString()));
        inputControlArgs.add(new Argument(Argument.RU_REF_URI, reportChild
                .getUriString()));
        try {
            ResourceDescriptor inputControlData = server.getWSClient().get(
                    inputControlDescriptor, null, inputControlArgs);

            if (inputControlData.getQueryData() != null) {
                @SuppressWarnings("unchecked")
                List rows = inputControlData
                        .getQueryData();
                for (InputControlQueryDataRow rowVal : rows) {
                    StringBuffer label = new StringBuffer();
                    for (int k = 0; k                         label.append(((k > 0) ? " | " : ""));
                        label.append(rowVal.getColumnValues().get(k));
                    }
                    inputData.put(label.toString(), rowVal.getValue()
                            .toString());
                }
            }
        } catch (Exception e) {
            throw new ReportingException(e);
        }
        return inputData;
    }

Thanks in Advance.

kunalbhatia.87's picture
Joined: Oct 1 2012 - 12:35am
Last seen: 7 years 9 months ago

0 Answers:

No answers yet
Feedback