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

 

Cognos 8.4.1 JavaScript question: Rerun Report for a dynamically set list box pr

Started by dtopicMedV, 12 Jan 2011 07:53:05 AM

Previous topic - Next topic

dtopicMedV

Hi,

I have several dashboard reports created in Report Studio (C8.4.1).
There is no prompt page; all prompts are on the report page itself.
I have a list box multi-select prompt that I was able to figure out-with your help.
When report is executed,via html item next to the promp, I set dynamically first element in the list to be selected if and only if nothing is selected.
However, I am missing one last step, I need to refresh/re-run report only if dynamically first element in the list was selected.
Can somebody help with the code below...

Thanks a lot in advance!


<script language="javascript">
var f = getFormWarpRequest();
var list = f._oLstChoicesProductGroup;
var Counter = 0;
var ii;
for ( ii = 0; ii < list.length; ii++)
{
    var node = list[ii];
    if (node.checked) { Counter++; }
}
if ( Counter < 1)
{list[0].selected=true;
--need to rerun report here
}
</script>

Arsenal

I believe promptButtonFinish() should do the trick

so

promptButtonFinish();
}
</script>

might be your solution

MFGF

Impressive!  (especially for someone who claims not to be a javascript expert!)

Thanks Arsenal!

MF.
Meep!

melee

I believe it's promptAction('finish') for 8.3 and above.

Edit: You may want to delay the refresh - this is useful when your user would like to keep selecting.

setTimeout("promptAction('finish')",3000); // Wait a few seconds, and dispatch the promptAction('finish'), which refreshes the page

Edit2: While this code will work, I don't think your selections will stick after the page reloads.

dtopicMedV

yes,
promptButtonFinish();
works as well as
if ( canSubmitPrompt() )
promptButtonFinish();
and
promptAction('finish');
but only when report is executed first time.
So,  default prompt value doesn't exist, report is executed twice, first item is selected and report is refreshed and filtered by parameter correctly.
But, it doesn't work correctly when another prompt (Required, One select, let's call it Product Type) with Auto-Submit=Yes is clicked. In that case, report executes only once, first item in the original prompt is selected, but report is not filtered by it (it doesn't re-execute). Report is filtered only by Product Type but when you look into prompts, first item on the Product Group is selected. So report and prompts are out of sync.

I may actually have to remove Auto-Submit=Yes everywhere and just display one "Refresh Dashboard" button.

THANKS EVERYBODY!

melee

After figuring out what "Auto-Submit" does (which is call the functions you listed), you shouldn't need it anymore. I use event listeners (if the input box changes, wait 3 seconds, then refresh) to accomplish this.