Cognos Analytics

 View Only
  • 1.  Prompts Set By JavaScript Correct Only AFTER First Execution

    Posted Wed January 29, 2020 04:27 PM

    ​Hello - Hoping someone has seen this before and can suggest where I should be looking to correct it.
    I have a very busy Prompt page (over 40 objects) with JavaScript code driving and validating selections.
    All that works in other reports. But in one report the selected Prompt Value is not set properly the first time the report is executed.
    But if the user then re-executes the same report in the same window with the same prompt values selected, this particular prompt value is set correctly.
    Yes, it's strange to experience. Made my testing crazy because sometimes the value was there and other times it wasn't.

    Anyone seen something like this before? Suggestions?

    Thanks



    ------------------------------
    Regards,
    Opher
    ------------------------------

    #CognosAnalyticswithWatson


  • 2.  RE: Prompts Set By JavaScript Correct Only AFTER First Execution

    Posted Thu January 30, 2020 07:33 AM
    Are you setting default values inside of $(document).ready(function () {});?

    ------------------------------
    Patrick Garner
    ------------------------------



  • 3.  RE: Prompts Set By JavaScript Correct Only AFTER First Execution

    Posted Thu January 30, 2020 07:53 AM
    Edited by System Fri January 20, 2023 04:33 PM
    Hello @Opher Banarie,

    I think that your javscript (thread) works more fast than the IBM Cognos Analytics for set ​the param values (another thread). Try to call the "Finish" button in Cognos Analytics through javascript when you finish to set all the prompt params in the prompt page.

    You can do this by this way:

    1 - Establish a name to the FInish button.


    2- Use this code to call the buttom through javascript.

    -------------
    // For import the report Jquery library

    var iframeBody = document.getElementsByTagName("body")[0];
    var jQuery = function (selector) { return parent.jQuery(selector, iframeBody); };
    j$ = jQuery;

    // For call the finish button

    j$( 'button[name=btn_finish]' ).trigger('click');

    --------

    I wish that this solve your problem.

    Best Regards.


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



  • 4.  RE: Prompts Set By JavaScript Correct Only AFTER First Execution

    Posted Thu January 30, 2020 12:53 PM
    ​Thank you @Robert Berchtold Palacios, but it does not resolve the problem. :(​

    ------------------------------
    Regards,
    Opher
    ------------------------------



  • 5.  RE: Prompts Set By JavaScript Correct Only AFTER First Execution

    Posted Thu January 30, 2020 02:20 PM
    Can you try with hidden prompt page with default values with Auto submit JS to go to next page where all Prompt Objects are there?

    ------------------------------
    Buddhi Gupta
    ------------------------------