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

value prompts with multi-page

Started by BIExpert, 18 Mar 2009 07:57:08 AM

Previous topic - Next topic

BIExpert

Hello all,

i'm using 8.3 edition. i've a multi-page to display some reports in tabs. each report contains 3 value prompts on the report page, 1st prompt to show years, second to show months and the last one to show days.

i wrote a javascript function to get the current date and display the current year in years prompt, current month in months prompt and so on.

and i put this function in html item at each report.

now when i run the multi-page the report in the first tab shows the current date correctly. but when i move to other tabs the function doesn't work and the prompts just show the
  • item.

    here's what i wrote at each html item:


    <script language="javascript">

    function onloadH()
    {

    var date_now = new Date();
    var month_now = date_now.getMonth() ;
    var day_now = date_now.getDate() ;

    if (month_now < 7)
    {
    month_now = month_now +6;
    }
    else
    {
    month_now = month_now -6;
    }

            document.formWarpRequest._oLstChoicesYearParameter[document.formWarpRequest._oLstChoicesYearParameter.length-1].selected = "true";
            document.formWarpRequest._oLstChoicesMonthParameter[month_now+2].selected = "true";
            document.formWarpRequest._oLstChoicesDayParameter[day_now+1].selected = "true";

    }

    window.onload= onloadH;
    </script>


    now could you please tell me why this function works fine at the first report and doesn't work at the others ? and is there any relation between this problem and the tabs of the multi-page ?

    thanks in advance.

Sunchaser

Hi,

First, one thing I don't understand is that the could we see only change the "selected" property of some objects (if I correctly understand what i see).

So what else is it supposed to do, or where is the code that is supposed to change some other property ?

BIExpert

thanks Sunchaser for ur reply..

this javascript function is the whole code which i wrote. because as i know i don't need to write more code to make the value prompts shows the current date as the default selection. So please if you see that this code missing anything please tell me.

finally i wanna say this function as it is right now works fine when i run the report from its own page. but when i run the multi-page this function works fine with the report in the first tab, but when i navigate to the other tabs to see the other reports, the value prompts didn't display the current date. just display the first member in the list.

i hope that i could make the problem clear now. thanks again.

Sunchaser

Hi,

As you said:
Quote
put this function in html item at each report

have you tried and tested each html item to be sure that the code is executed while the onload event occurs ?

I mean: I don't know what a multipage report looks like, but may be the onload event will "trigger" only the code of the HTML Item of the fist page ?

BIExpert

hello,

i tested the onload event in each html item, when i try something like window.onload = alert('hello'); it's working fine, or when i call the same function but instead of my code i tried something like document.write('hello'); and it's working too.

about the multi-page i just make it read from the folder of the reports' pages to display these pages in tabs nothing else.

i really couldn't find the problem and hope you could help me to find it. thanks again.

rockytopmark

let's dig deeper, if possible... why all this custom code?!?

Why not just use a single calendar control?  If I am not mistaken, they default to the current date...

I am not a fan of custom code that will probably break in future releases of Cognos and is generally doing something that can also be done with standard Cognos tools and functions.

Besides that, not too many users will appreciate having to set three controls, to set one date, when it is normally done with 1 control on just about every website.

If you can elaborate more on the purpose of the prompts, perhaps we can help you get a better solution that is functional and easier to maintain.