Cognos Analytics

Cognos Analytics

Connect, learn, and share with thousands of IBM Cognos Analytics users! 

 View Only
Expand all | Collapse all

How do I make default Date prompt to select Current_Date as default value for the Report

  • 1.  How do I make default Date prompt to select Current_Date as default value for the Report

    Posted Mon October 30, 2023 03:55 PM

    Hello Team,

    Raising this question, I did try some options: default selection in value prompt is first value | Cognos Analytics (ibm.com) but was not successful.

    The Issue here is the default date Parameter is coming from FM model package, which we cannot disable.

    How do I make the default date prompt to select the current date, and run the report without prompt page, so I can schedule the report to run on daily basis without manual intervention. 

    where we need the values flow related to Departure Date, which is filtered at the present moment with the default snapshot date. 

    Kind Regards,

    Varshini Niharika 



    ------------------------------
    Varshini Niharika
    ------------------------------



  • 2.  RE: How do I make default Date prompt to select Current_Date as default value for the Report

    Posted Tue October 31, 2023 08:28 PM

    Hi Varshini,

    We set a default value for the prompt (say 2099-12-12) and have the filter expression like

    ?p_SnapshotDate? = 2099-12-12 and [Departure Date] = current_date or [Departure Date] = ?p_SnapshotDate?



    ------------------------------
    David
    ------------------------------



  • 3.  RE: How do I make default Date prompt to select Current_Date as default value for the Report

    Posted Wed November 01, 2023 02:31 PM

    Hello David,

    Thank you for reply with your inputs, Yes that would work too. 

    But I did you use this below IBM article and have applied an extra value prompt & static choices as 1 and 2, when 1 : Departure Date= current date and 2 uses the p_SnapshotDate other than current date. So, when scheduling I have defaulted parameter to be set to 1. 

    https://www.ibm.com/support/pages/how-pass-current-date-scheduled-report-prompt

    Kind Regards,

    Varshini



    ------------------------------
    Varshini Niharika
    ------------------------------



  • 4.  RE: How do I make default Date prompt to select Current_Date as default value for the Report

    Posted Thu November 02, 2023 04:10 AM

    Hi, Wouldn't it be an option to use the parameter within a prompt macro (with default current_date)? Then the report prompt would be optional only (with default current_date).



    ------------------------------
    Philipp Hornung
    Business Intelligence Manager
    Techniker Krankenkasse
    Hamburg Germany
    #IBMChampion
    ------------------------------



  • 5.  RE: How do I make default Date prompt to select Current_Date as default value for the Report

    Posted Fri November 03, 2023 04:44 AM

    Hi,

    I made it with _add_days(date; ?dateprompt?) and set a default value 0. In my prompt selection I have an extra-query that shows dates but gives the differente to current_date to my prompt. I hope you understand my answer, if not  feel free to contact me directly. 

    regards

    Jan



    ------------------------------
    Jan Geesen
    ------------------------------



  • 6.  RE: How do I make default Date prompt to select Current_Date as default value for the Report

    Posted Sun January 28, 2024 05:45 PM

    Hi Jan,

    Sorry for the late reply, I did not get the method you followed for the above? 

    The Date prompt (pSnapshot date) in our Report studio is coming as required, how can I bypass that using the above method. 

    Kind Regards,

    Varshini



    ------------------------------
    Varshini Niharika
    ------------------------------



  • 7.  RE: How do I make default Date prompt to select Current_Date as default value for the Report

    Posted Mon January 29, 2024 01:04 AM

    Hello All/IBM Champions,

    So, what is happening with the prompt solution applied, it works fine when we run it manually and by choosing Parameter1 =1 and the pSnapshot_date=Yesterday_date.

    The Report Query filter = if (? Parameter1? =1) then ([Departure Date]>= [Yesterday date] or [Departure Date] < [Yesterday date]) else ([Departure Date]>=?p_SnapshotDate? or [Departure Date] <?p_SnapshotDate?)

    The Issue now is:

    when we schedule this report to run automatically: with prompt values as below:

    It always picks up the pSnapshot_date= 2024-01-01 and passes the value to report to run, even when the Parameter1= 1.

    But for the report to have right values, it should pick up pSnapshot_date= yesterday's date even if the prompt specifies a date from the scheduled run.  I am not sure, if this is defect or can we write the query filter differently to achieve that?

    Kind Regards,

    Varshini



    ------------------------------
    Varshini Niharika
    ------------------------------



  • 8.  RE: How do I make default Date prompt to select Current_Date as default value for the Report

    Posted Mon January 29, 2024 02:30 AM
    Edited by René Kent Nielsen Mon January 29, 2024 02:32 AM

    Hi,

    Put you if statement in a query object insted, lets call it DepDateFilter :

     if (? Parameter1? =1) then (_add_days(current_date;-1) ) else (?p_SnapshotDate?)

    And then the filter would be :

    [Departure Date]>= [DepDateFilter]

    I don´t get the 2 or in you filter, it will return all dates if you have a >=  follow by a < on the same date.

    #IBMChampion



    ------------------------------
    René Kent Nielsen
    Brand manager
    CogniTech A/S
    Herning
    ------------------------------



  • 9.  RE: How do I make default Date prompt to select Current_Date as default value for the Report

    Posted Mon January 29, 2024 08:48 PM

    Hello Rene, 

    Thank you for your reply, the above will only work, if we need the Data filtered on only Departure Date >= Yesterday's date. But the requirement here is to get all the data of Departure date old(<) and new(>=), on a pSnapshot date which should be Yesterday's date. 

    But because pSnapshot is a Date prompt coming from the FM package as default, we cannot make the parameter pSnapshot = Yesterday date bypassing the prompt value given in Scheduled report. How to do that. 

    Hope you are getting what I am trying to achieve here. 


    Kind Regards,

    Varshini



    ------------------------------
    Varshini Niharika
    ------------------------------



  • 10.  RE: How do I make default Date prompt to select Current_Date as default value for the Report

    Posted Tue January 30, 2024 04:28 AM

    Hi,

    The filter would be 

    [Departure Date]>= [DepDateFilter] or [Departure Date]< [DepDateFilter] 

    But it will return every [Departure Date], so why would you use a filter ?

    #IBMChampion



    ------------------------------
    René Kent Nielsen
    Brand manager
    CogniTech A/S
    Herning
    ------------------------------



  • 11.  RE: How do I make default Date prompt to select Current_Date as default value for the Report

    Posted Tue January 30, 2024 07:24 PM

    Hello Rene/All,

    The Data requirement is for all Departure Dates restricting for 2 years but for the particular snapshot date i.e. being Yesterday's date.

    So originally using IBM article,
    https://www.ibm.com/support/pages/how-pass-current-date-scheduled-report-prompt

    we tried to use the Parameter 1 so, we can bypass the parameters in scheduled reports, but it did not work. So, need a solution where I can make the pSnapshot date = Yesterday date and get all the Departure dates> 2years 

    I.e.

    on a day: 02-01-2024 the data value was 10 Qty for specific elements for departure date 2-02-2024

    on a day: 02-01-2024 the data value was 11 Qty for specific elements for departure date 3-02-2024, and it will remain same until next product is sold. 

    so, on other day: 

    15-01-2024 the data value changed to 15 Qty for specific elements for departure date 2-02-2024

    15-01-2024 the data value changed to 14 Qty for specific elements for departure date 3-02-2024

    So, we need, the report to run automatically, for the snapshot date on 30-01-2024 as of today(31-1-2024) and give all the details of the elements for all departure dates on that particular day. 

    But now, even having Parameter set to 1, if the snapshot date = 2-1-2024, it is not overriding and still using the snapshot =2-1-2024 rather than 30-1-2024

    and providing wrong data.

    Thanks,

    Varshini



    ------------------------------
    Varshini Niharika
    ------------------------------



  • 12.  RE: How do I make default Date prompt to select Current_Date as default value for the Report

    Posted Mon February 05, 2024 02:49 AM

    Hi, 

    If i read this correct the ?pSnapshotdate? is in the FM package filter, then it will always be mandatory.

    Don´t you have access to the FM package ?

    And what version of Cognos Analytics is you running ?

    #IBMChampion



    ------------------------------
    René Kent Nielsen
    Brand manager
    CogniTech A/S
    Herning
    ------------------------------