If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Run a Report with No parameters or one parameter

Started by TheBrenda, 28 Jun 2016 01:51:23 PM

Previous topic - Next topic

TheBrenda

I am trying to use the 10.1.1. SDK Sample RunReport. There are two reports that I want to run. One report (report1) has no parameters and one report (report2) has a single parameter. I do not want to prompt the user. I know the parameter name (at lest what the dropdown control is called in report studio) and what I want for the value.

1)  How do you run a report with no parameters?  I am using the following "run" java command. Assumed with no parameters it would just be the following.

ParameterValue parameterValues[] = new ParameterValue[] {};
run(objectPath, parameterValues, options)

I have also tried

ParameterValue parameterValues[] = null;
run(objectPath, parameterValues, options)

Both give me a NULLPointerException.

2) How do you run a report with a single parameter? Obviously I have no idea since I cannot get #1 to work.

TheBrenda

First, the NULLPointerException was because my Cognos password was wrong. It appeared to log me in correctly but once I fixed the password it started "working" ... or at least producing an report.

Got this to work for a report with no parameters

ParameterValue emptyParameterValues[] = new ParameterValue[] {};
ParameterValue parameters[] = null;
parameters = emptyParameterValues;


BUt for a report with a single parameter, I do not want to prompt, I know the parameter name and the value that I want ... how to code that. I tried this but it returned the prompt page as the report output. Can someone help with setting the parameter name and value for running a report in the SDK? Thanks

ParameterValue[] parameters = new ParameterValue[1];       
parameters[0] = new ParameterValue();           
parameters[0].setName("ForcastingYear");       
String year = "2011";       
SimpleParmValueItem valueItem = new SimpleParmValueItem();       
valueItem.setUse(year);       
valueItem.setDisplay(year);       
valueItem.setInclusive(true);           
ParmValueItem parmValueItems[] = new ParmValueItem[1];       
parmValueItems[0] = valueItem;           
parameters[0].setValue(parmValueItems);