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

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

how to degin Checkbox auto submit=yes in report page

Started by Revathi_M, 13 Dec 2014 11:57:27 AM

Previous topic - Next topic

Revathi_M

Hi anybody

i am using 10.2.1 version and relational data base.
step by step
how to implement check box  auto submit =yes in report page

my team member implement like that only but he is out of station .
he taken value prompt and list both are spare query's   in report page itself. but we are taken same thing still show auto-submit is NO in report age



CognosPaul

Normally multi-select prompts like checkboxes cannot be set to auto-submit. This is expected, as how do you know when a user is finished selecting the values? Live reports often take a long time to run, and users tend to dislike having to laboriously select one... option... at... a... time...

JavaScript can be used to do this. One quirk of the prompt API is that we are unable to determine if the source of the validation attempt is from the user (clicking on it) or from the report (validating on first load). My quick work-around is to create an array and push the prompt name into the array if it isn't in there already. If it is in there, then the user must have clicked on it.

It's not entirely foolproof, and if I spend more than 5 minutes I might be able to find a better solution, but who has that kind of time?

<script>

paulScripts ={}
, oCR = cognos.Report.getReport("_THIS_");

paulScripts.getControl = function(promptName) {
  return oCR.prompt.getControlByName(promptName);
};


paulScripts.reprompt = function(){
  oCR.sendRequest(cognos.Report.Action.REPROMPT);
  return true;
};

paulScripts.arrayContains = function (array,search){
  arrlen = array.length;
  for (var i=0;i<arrlen;++i){
    if(arrlen=search) return true;
  }
  return false;
}
paulScripts.forceSubmit = (function (){
  var timer
  ,firstCheck=[];
  return function(name){
    clearTimeout(timer);
    timer = window.setTimeout(function(){
      if(paulScripts.arrayContains(firstCheck,name)) {paulScripts.reprompt()} else {firstCheck.push(name)}
    }
    ,300);
    return true
  };
})();

paulScripts.getControl('Years').setValidator(function (){paulScripts.forceSubmit ('Years');return true;});
</script>


Make sure that the HTML item that contains the setValidator is placed after the prompt. You can control the wait time by changing the 300 to something longer.

gcorker

I know its 9 years on, but thank you Paul.  I was able to incorporate this into a report and it works very well in 11.1.7.
No doubt it will serve as a template in the future.

I was able to enter a dummy value for my multi select prompt default value which then presents as if nothing has been selected yet.

dougp

I just need to state here:  I think this was a horrible change that IBM made.  In 10.2.1 it was possible to set a value prompt to be multi-select AND autosubmit.  It is not the vendor's job to determine how my reports perform.  It's my job, as the report developer, to ensure reports perform well.  Of course, the simple solution is to make the user click the Finish button (On the report page?  That's tacky.)  There are times when I need to use multi-select with autosubmit.  Right now I must hack the report spec's XML then "save as" to accomplish this, then remember to not touch those settings in the UI.

By the way:  How does this work in a dashboard?  Multi-select and autosubmit is the norm.  In fact, it's not even configurable.  So why not in a report?