COGNOiSe.com - The IBM Cognos Community

IBM Cognos Analytics Platform => Cognos Analytics => Reporting => Topic started by: jems2021 on 20 Jan 2021 06:36:38 PM

Title: Cognos Custom Control.prototype.getParameters
Post by: jems2021 on 20 Jan 2021 06:36:38 PM
I am a newbie.  I have two parameters I am trying to set from js file.  The following is my custom control configuration:

{
    "Button label": "Employee",
    "Button value": "Employee ID",
    "Button Height": "40px",
    "Button Width": "200px",
    "Parameter": "paramEmp",
    "Parameter2": "paramLst",
    "lstValue": "Employee",
    "Background Color": "#4178BE",
    "Font Color": "#ffffff",
    "Font Family": "Arial",
    "Font Size": "10pt"
}

My getParameters function is:
Control.prototype.getParameters = function (oControlHost) {

      return [
      {
         "parameter": oControlHost.configuration["Parameter"],
         "values": [ {
            "use" :  oControlHost.configuration["Button value"], "display" : oControlHost.configuration["Button label"]
         }]
      }
      {
         "parameter: oControlHost.configuration["Parameter2"],
         "values": [ {
            "use" :  oControlHost.configuration["lstValue"], "display" : oControlHost.configuration["lstValue"]
         }]
      }
      ];
   };

I am getting the error below when I run the report:
SyntaxError: Unexpected token '{'

It looks to me that all tokens are paired.  What am I missing?

Please help.  Thanks.
===================
Made the following modification for Parameter2 and the error went away.  However, Parameter2 is not being updated in the report.
   Control.prototype.getParameters = function (oControlHost) {

      return [
      {
         "parameter": oControlHost.configuration["Parameter"],
         "values": [ {
            "use" :  oControlHost.configuration["Button value"], "display" : oControlHost.configuration["Button label"]
         }],
         "parameter": oControlHost.configuration["Parameter2"],
          "values": [{
            "use" : oControlHost.configuration["lstValue"]
         }]

      
      
      }
      
      ];
   };

   Control.prototype.f_onClick = function (oControlHost) {
      oControlHost.valueChanged();
      oControlHost.next();
   };

   return Control;

Why is Parameter2 not being updated in the report?
Thanks for your help.
Title: Re: Cognos Custom Control.prototype.getParameters
Post by: jems2021 on 22 Jan 2021 10:02:04 AM
@dougp  Please take a look.
Title: Re: Cognos Custom Control.prototype.getParameters
Post by: MFGF on 22 Jan 2021 10:26:48 AM
Quote from: jems2021 on 22 Jan 2021 10:02:04 AM
@dougp  Please take a look.

Hi,

It's not really appropriate to instruct another forum member to answer your questions. People who provide guidance and assistance here do so of their own free will, and out of a desire to help others where they can. I understand that you're keen to have answers, but please be mindful that other members are under no obligation to respond, and individuals might feel taken for granted if pushed to answer like this. My experience is that these sorts of messages can have the opposite effect to the outcome you're hoping for, and can dissuade an individual from responding. In short, please be courteous to other forum members.

MF.
Title: Re: Cognos Custom Control.prototype.getParameters
Post by: dougp on 25 Jan 2021 02:41:45 PM
Right away I see syntax errors in both versions.  I haven't actually worked in the bowels of the IBM Cognos Scriptable Reports API for months, so I can't tell at a glance if there are logic problems.
Title: Re: Cognos Custom Control.prototype.getParameters
Post by: jems2021 on 01 Apr 2021 05:56:58 PM
Thank you.