Cognos Analytics

Cognos Analytics

Connect, learn, and share with thousands of IBM Cognos Analytics users! 

 View Only

Set default value for a param by custom control (Javascript)

  • 1.  Set default value for a param by custom control (Javascript)

    Posted Mon January 27, 2020 06:24 AM
    Edited by System Admin Fri January 20, 2023 04:48 PM
    Hello Community,

    I have a problem trying to set a default value to a Cognos Analytics parameter through Custom Control (Javascript).

    In my report, i have a 'prompt' with the name prompt-p_year that it have the autosubmint property in true.

    The custom control call the next code:

    -------
    var control = oControlHost.page.getControlByName('prompt-p_year');
    var prompt_value = control.getValues();

    if(prompt_value[0]['use'] == null){

            var prompt_values = control.getValues(true);
            var max_value = 0; console.log(prompt_values);

            prompt_values.forEach( function(valor, indice, array){
                  if(valor['use'] > max_value) max_value = valor['use']
            });

         control.setValues([{'use':max_value, 'display': max_value}]);
    }
    --------
    When the default value is set to the prompt. The web page is refresh some times until the param is set to default value.

    I want a solution for that the user dont percive all the refresh that the page do while it is setting the default value to the param.

    Note: Set the autosubmit in false isn't an option, because we need that when the user change manually the value of the 'prompt', the report update automatically the values and charts of the page.

    Thanks in advance,
    Best Regards.






    ------------------------------
    Robert Berchtold Palacios
    Business Intelligence Developer
    Saima Abassy
    Sant Cugat del Vallés
    ------------------------------
    #CognosAnalyticswithWatson