Skip to Content
0
Former Member
Dec 04, 2008 at 11:06 PM

IllegalArgumentException when trying to schedule report w/ Date param(s)

37 Views

Hi,

This has been frustrating me all day and I just can't seem to get it working...

We have a java system built on the business objects SDK which will allow scheduling of reports through a web-app.

Works fine with 'normal' parameters however when I try to set a date parameter I get a IllegalArgumentException with the message 'Invalid Argument Type' ... ?

To set the parameters prior to scheduling I am doing:

        List ceParameters;
 
        // get the parameter list for this report
        try {
            ceParameters = iReportInstance.getReportParameters();
        } catch (SDKException e) {
            //snip
        }
 
        // iterate through the crystal parameter list, and set runtime values
        String setVal;
        for (Iterator i = ceParameters.iterator(); i.hasNext();) {
            IReportParameter ceParam = (IReportParameter) i.next();
 
            ceParam.getCurrentValues().clear();
 
            setVal = "something"; //actual value passed to method in List, just example
 
            if (setVal != null)
                ceParam.getCurrentValues().addSingleValue().setValue(setVal);
        }
 
        //... continue to scheduling ...
 

The above works fine for normal parameters but immediately errors upon trying to set a Date. Now the .setValue(...) takes a String obviously so I have tried many different formats here if the parameter is meant to be a date, including the date format String specified by: om.crystaldecisions.sdk.plugin.desktop.common.IReportParameterValue.DateFormat however the error persists.

Am I making some really basic mistake here? If anyone could help me out with this I'd greatly appreciate it 😔