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

Prompt value with JavaScript and Scheduler

Started by Esperanza, 16 Jul 2015 10:32:23 AM

Previous topic - Next topic

Esperanza

Hello Cognos Experts!
I have a prompt page and a JavaScript HTML which select by default a date that changes every month.
This is working well.
The problem is with the scheduler.  If I schedule the report, the report failed with the following error:

The query contains one or more unresolved prompts. QE-DEF-0144 'pDate' has no substitution values.

Is there a way in JavaScript to assign the defaut value, so it could work with the scheduler?
Here is my JavaScript (my query has only one line):

<script type= text/javascript>
//<!–
function getPromptValue(pName)
{
//get report
var oCR = cognos.Report.getReport("_THIS_");
//get prompt control
var oc = oCR.prompt.getControlByName(pName);
var promptValues = oc.getValues(true);
var v=new Array();
var j=0;
//loop through all prompt value, select those meet criteria
for (var i = 0; i < promptValues.length; i++)
{
//check
if ( promptValues.use >= 20150101)
{

v [j] = { 'use': promptValues.use , 'display': promptValues.display }
j=j+1
}
}
oc.setValues(v);
}
getPromptValue("mylist");


//–>

</script>

Esperanza

I found an easier way to do it.
The following Java script works fine.
My current value is selected and the report run (if done manually) with the selected value and the data is good.
Again, the problem is with the scheduler.  I got the following error :
QFS-ERR-0139 The request has multiple errors. RQP-DEF-0354 The query contains one or more unresolved prompts. QE-DEF-0387 Invalid format for numeric prompt 'pDate'.
How can it works manually but not via Cognos Scheduler ?

-----------------------------------
<script language="javascript">

function setDefaultValue()
{
var form = getFormWarpRequest();
form._oLstChoicesmylist.options[0].selected = true;

}

setDefaultValue()

</script>
---------------------------------------------

bdbits

Javascript does not execute when a job runs from a schedule.