Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
9 replies Latest Post - ‏2014-03-01T14:20:05Z by ManikanthVangala
ManikanthVangala
ManikanthVangala
7 Posts
ACCEPTED ANSWER

Pinned topic Dynamic Date Prompt

‏2014-02-02T08:49:00Z |

Could you guyz help me..I have a requiremnt like Making Default selection for Date prompt to be dynamic (First of Month) for From date and (End of Month) for To Date.I dont have any prompt page. When user opend my report he has to see two dates showing above mentioned reuiremnt.

Noye :: No prompt page is there and its a Date Prompt Not Value Prompt.

  • Cognos101
    Cognos101
    3 Posts
    ACCEPTED ANSWER

    Re: Dynamic Date Prompt

    ‏2014-02-03T19:59:15Z  in response to ManikanthVangala

    Not knowing exactly what you are trying to do, thought I would share a tid bit here...

    I went with creating a separate query for the date, in my case it was the quarter, but you could alter it to be month.

     

    SELECT  trunc(sysdate,'q') as "first day curr qtr",

    TO_DATE(trunc(trunc(sysdate,'q')-1,'q')) as "first day prev qtr",

    TO_DATE((to_char(trunc(trunc(sysdate,'q')-1,'q'),'RRRR-MM-DD')||' 00:00:00'),'yyyy/mm/dd hh24:mi:ss') as "first day prev qtr dttm",

    TO_DATE((to_char(trunc(sysdate,'q')-1,'RRRR-MM-DD')||' 23:59:59'),'yyyy/mm/dd hh24:mi:ss') as "last day prv qtr dttm"

    from dual

    • ManikanthVangala
      ManikanthVangala
      7 Posts
      ACCEPTED ANSWER

      Re: Dynamic Date Prompt

      ‏2014-02-06T04:51:27Z  in response to Cognos101

      Hi..

      Thanks for your reply.. My exact req is i ll will b having two date prompts of calender type (Lets say Param From and Param To) and a list view contains some data w.r.t that period.By deaflut user will be opening a report with out asking any prompts so that report has to be open with by default with First of Month and current date (Param From and Param To resp.).So if i dont assign any default value to this calender prompts i am able to show current date in my Param To but i want in Param from as First of Month every Month (dynamic).Hope you get to know still if any dout please ask me and help me out.. :(

  • TimTam18
    TimTam18
    11 Posts
    ACCEPTED ANSWER

    Re: Dynamic Date Prompt

    ‏2014-02-07T05:24:03Z  in response to ManikanthVangala

    I haven't tried myself yet but there is a Proven Practice article on this topic. Check it out here:

    http://www.ibm.com/developerworks/library/ba-pp-reporting-scripting_techniques-page634/

    Hope it helps,

    TT

    • ManikanthVangala
      ManikanthVangala
      7 Posts
      ACCEPTED ANSWER

      Re: Dynamic Date Prompt

      ‏2014-02-07T07:31:44Z  in response to TimTam18

      helloo TT,

      Thanks for your response and supportive link.But i had seen this and tried it. but it was not working... :( :( Could you please help me with anyother way.

      • TimTam18
        TimTam18
        11 Posts
        ACCEPTED ANSWER

        Re: Dynamic Date Prompt

        ‏2014-02-09T21:09:21Z  in response to ManikanthVangala

        Hi,

        If the above fails, another option I can think of is:

        - use Value Prompt instead of Day Prompt

        - Code the first/last dates of month from the data source or Framework Manager

        - use these values as default values in the prompts

        Hope this helps,

        TT

         

        • ManikanthVangala
          ManikanthVangala
          7 Posts
          ACCEPTED ANSWER

          Re: Dynamic Date Prompt

          ‏2014-02-10T05:43:26Z  in response to TimTam18

          Hi TT,

          Thanks for your reply and advise but i dont want to change req. Beacause thats not good to go with Value Prompt if i want to show date wise data and btw i acheived with value prompt :( :( .I really appreciate if you can help me with Date Prompt...

          • LucNguyen
            LucNguyen
            11 Posts
            ACCEPTED ANSWER

            Re: Dynamic Date Prompt

            ‏2014-02-20T08:05:28Z  in response to ManikanthVangala

            Create a query "SetDefault" with data item "FromDate": _first_of_month(currentdate).

            Create a prompt page, in prompt page, insert a value prompt(parameter name= varFromDate,multiselect=no, auto submit=no, use value= FromDate, Visible =no) use SetDefault query. Add a html item after value prompt:

            <script language="javascript">
             
            function setPrompts()
            {
                  var f = getFormWarpRequest();
                  f.getElementsByTagName("select")[0][2].selected = true;
                  promptButtonFinish();
            }
            </script>
            <body onLoad=setPrompts()>

            In report page, create a Date Prompt(parameter name=varFromDate,  Default selection(any)).

            Good luck!

             

            • ManikanthVangala
              ManikanthVangala
              7 Posts
              ACCEPTED ANSWER

              Re: Dynamic Date Prompt

              ‏2014-02-21T06:29:06Z  in response to LucNguyen

              Dear LucNguyen,

              Thats really great..Its working.Half of my requiremnmet got fullfilled.Thank you very much :) :)

              • ManikanthVangala
                ManikanthVangala
                7 Posts
                ACCEPTED ANSWER

                Re: Dynamic Date Prompt

                ‏2014-03-01T14:20:05Z  in response to ManikanthVangala

                Dear LucNguyen,

                Thanks alot for your advice and its really working fine when i am running report from Report Studio but when i am running from Cognos Viewer i mean i am attching a portal to a user who opens this report but then this JS is not working fine.But i did RnD on this an i got some code like this

                 

                function setPrompts()
                {      

                var fW = (typeof getFormWarpRequest == "function" ? getFormWarpRequest() : document.forms["formWarpRequest"]);
                if ( !fW || fW == undefined) { fW = ( formWarpRequest_THIS_ ? formWarpRequest_THIS_ : formWarpRequest_NS_ );};
                var preFix = "";
                if (fW.elements["cv.id"])
                {
                preFix = fW.elements["cv.id"].value;
                }
                setTimeout('oCV' + preFix + '.promptAction(\'finish\')', 0);

                }

                </script> <body onLoad=setPrompts()

                Its working but its not filtering any query by default :( :( but just showing output on date prompt :'( :'( .

                Please help me out...