0

I am trying to write a java application to access a report in Cognos 11. I am trying to pass a parameter into the report. For now, it's proof of concept so it is hardcoded string. Problem is when I use this method, the output HTML file is the parameter page and not the underlying report.

        ParameterValue parameters[] = new ParameterValue[1];
        parameters[0] = new ParameterValue();
        parameters[0].setName("pFundingDescription");

        ParmValueItem[] pvi = new ParmValueItem[1];
        SimpleParmValueItem item = new SimpleParmValueItem();
        item.setUse("AUTO PAYMENTS");
        pvi[0] = item;

        parameters[0].setValue(pvi);

The parameter name in the report is "pFundingDescription" and it is a mutli-select which includes the option "AUTO PAYMENTS".

How do I make this work?

ps: I was looking at this question to get as far as I did: Cognos v11 SDK Parameter Passing

ajspacemanspiff
  • 478
  • 1
  • 10
  • 21

2 Answers2

0

Your code looks fine. My guess is that the prompt page is either being triggered by a report property to show it or required parameters not being present and it, therefore, prompting for them.

To experiment further, can you remove other prompts (or make sure any that can't be removed are 'optional') and change the report properties to instruct it not to prompt.

Olly Brand
  • 21
  • 1
  • 1
  • 5
0

I created a method that will process any array of ints (C#) i assume you can updates this to work in Java. Check this out and see if it helps.

private static parameterValue LoadMultipleInts(string varName, List<int> values)
    {
        try
        {
            var parameter = new parameterValue();
            parameter.name = varName.Trim();
            //Array size should equal number of id's passed in
            parmValueItem[] pvi = new parmValueItem[values.Count];

            for (int i = 0; i < values.Count; i++)
            {

                simpleParmValueItem item = new simpleParmValueItem();
                item.use = values[i].ToString();
                item.display = values[i].ToString();
                item.inclusive = true;
                pvi[i] = item;
            }
            parameter.value = pvi;
            return parameter;
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
gman
  • 167
  • 1
  • 16