COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: Aditi on 01 Mar 2011 01:45:10 AM

Title: Java Script in Cognos 8.4.1
Post by: Aditi on 01 Mar 2011 01:45:10 AM
Hi,
I am unable to make this script work in 8.4.1 while the same script works in 8.2 :

<script> target_url = '--------'

function Print_Report() {


to_set = target_url;
to_set += '&p_parcomment_textbox=';
to_set += escape(document.forms["formWarpRequest"].elements["_textEditBoxUID_C1"].value);

var obj = document.forms["formWarpRequest"].elements["_oLstChoicesUID_G"];
var GrdLst = '';   
var ii;

for(ii=0;ii<obj.length;ii++)
{
   if(obj.options(ii).selected)
       GrdLst = GrdLst + "&p_parGrade=" + obj.options(ii).value;      

}


//GrdLst = GrdLst.substr(0, GrdLst.length-1);
//alert(GrdLst);

//to_set += '&p_parGrade=';
//to_set += escape(document.forms["formWarpRequest"].elements["_oLstChoicesUID_G"].values);
to_set += GrdLst;


to_set += '&p_parGrade=';
to_set += escape(document.forms["formWarpRequest"].elements["_oLstChoicesUID_G"].value);



var obj1 = document.forms["formWarpRequest"].elements["_oLstChoicesUID_GC"];
var GrdCatLst = '';   
var jj;

for(jj=0;jj<obj1.length;jj++)
{
   if(obj1.options(jj).selected)
       GrdCatLst = GrdCatLst + "&p_pargradecategory=" + obj1.options(jj).value;      

}
to_set += GrdCatLst;


to_set += '&p_pardatefrom=';
to_set += (pickerControlUID_SD.m_oForm.value);

to_set += '&p_pardateto=';
to_set += (pickerControlUID_ED.m_oForm.value);

window.open(to_set);
}

</script>


also along with this script i have the second JS  :):

<input type="button" value="Print" onClick="Print_Report()">

Can anybody help ??? :-[
Title: Re: Java Script in Cognos 8.4.1
Post by: Shailaja0520 on 02 Mar 2011 01:04:01 AM
For the 3rd line in your function
escape(document.forms["formWarpRequest"].elements["_textEditBoxUID_C1"].value);

try changing to

escape(getFormWarpRequest()._textEditBoxUID_C1.value)


var obj = document.forms["formWarpRequest"].elements["_oLstChoicesUID_G"];

try changing to
var obj= (getFormWarpRequest()._oLstChoicesUID_G)

Try one by one line..put alert and check ..

For assistance check this link

download doc from this link

http://www-01.ibm.com/support/docview.wss?rs=0&uid=swg24021973
Title: Re: Java Script in Cognos 8.4.1
Post by: Aditi on 10 Mar 2011 03:29:09 AM
Suhan,
thanks for replying.
i got the script working by just changing the Form Warp Request.

But i would like to know which functions does not Cognos 8.4.1 supports which were used in cognos 8.2.
I am not aware of JS or Java.

is mylist function also not supported by 8.4??

following is the script which is also giving me an error.:


<script>
mylist = getFormWarpRequest().elements["_oLstChoicesAOP_CASE"];
mylist.remove(0);
mylist.remove(0);
mylist.onchange();
</script>
Title: Re: Java Script in Cognos 8.4.1
Post by: Shailaja0520 on 10 Mar 2011 04:47:53 AM
Yes it works in both way either by just replacing to getFormWarpRequest().

The code you have given to remove the dotted lines is working fine.

Just check if name of the value prompt is same  as AOP_CASE or this may not be the code which is giving you the error.

mylist is not a function.its just a variable name.it can be anything.for e.g  x

Just refer the doc link which i have given know about the supported functions.

Hope this helps you

Thanks
Title: Re: Java Script in Cognos 8.4.1
Post by: Aditi on 10 Mar 2011 09:39:43 AM
Hi Suhan,

I tried opening the link given by you, but i guess it has stopped working.

yes i checkd the name of the value prompt and it was wrong.
thanks for bringing this into light.
still my report doesn't works as desired.
I am again checking on the names of all the prompts mention (if they are correct).

I will post if i am stuck sumwhere..

Thanks a lot again!
:) :D :) 8)
Title: Re: Java Script in Cognos 8.4.1
Post by: Shailaja0520 on 10 Mar 2011 10:07:19 AM
Welcome Aditi  :)

Just click on the link ,it will open up with a page with Upgrading javascript applications.
You will find a link as FTP in the download options.click on that you will get a Winzip file to save.

The Forum always welcomes the queries..:)