Dynamic date parameters for a scheduled report that runs every day

I have a report that has input parameters for a start date and
end date. The report will be scheduled to run once a day at a
scheduled time. I need the report to automatically set the start
date and end dates when the report runs at the scheduled time.
When the report runs at the scheduled time, the end date needs
to be set to that time and the start date needs to be set to 24
hrs before the end date. I want the start and end dates to roll
forward automatically when the scheduled report runs each day. I
don't want any user intervention to change the start and end
dates every day. How can I do this in a report ?
Also, since the report is scheduled to run each day, I want the
output to be saved to a unique file name each time the report is
run as each day's report will report on the data only for that
day. How can I get the report to save to a unique file name
automatically each day ? Again, I don't want any user
intervention where they would set the output file name manually.

Try adding the following in the beforereport or beforepform
trigger, before the RETURN clause (TRUNC gets rid of the time
component of the date):
:p_date_from := TRUNC(sysdate) - 1;
:p_date_to := TRUNC(sysdate);
:desname := 'REPORT'||TO_CHAR(sysdate, 'DDMMYYYY')||'.txt'
Paul Williams

Similar Messages

  • Schedule Job to run every day at 01:00:00 i.e. mid-night 01:00 AM

    Dear Gurus,
    I want to create a job that will run every day at 01:00:00 i.e. mid-night 01:00 AM.
    and the above job will be started from 2-Jul-2010 01:00:00
    I have created below code.
    BEGIN
    DBMS_SCHEDULER.CREATE_JOB(
    JOB_NAME => 'Smry_Dly_Trial'
    ,JOB_TYPE => 'PLSQL_BLOCK'
    ,JOB_ACTION => 'BEGIN Periodic.Execute_Smry_Job(''HOURLY''); END;'
    ,START_DATE => to_date('2-Jul-2010 01:00:00','DD-Mon-YYYY HH24:MI:SS')
    ,REPEAT_INTERVAL => 'FREQ=DAILY; BYDAY=MON,TUE,WED,THU,FRI,SAT,SUN; BYHOUR=1;'
    ,ENABLED => TRUE
    ,COMMENTS => 'Generates Call Summary Daily');
    END;
    Could any one suggest me is it fine or any change needed.
    Regards
    Sanjeev

    Seems fine.
    You could also use trunc(to_date('01-jul-2010'))+1+1/24 for your start date.
    Regards,
    Amol

  • Need help on Date Parameters for BIP Report

    Hello,
    I need to add a date parameter in my BIP report. I have used a date parameter on a BIP report that has a for-each grouping, but my BIP report RTF template that was converted from Actuate do not have a for-each grouping and I was getting an error when I validate the RTF template. Can someone please help?
    Thank you

    can u send me template and xml . i will try at my side. email: [email protected]
    Some times converted templates won't work straight away. you still need to do manual adjustments to make it work based one the requirement u have.
    check this:
    http://bipconsulting.blogspot.com/2009/08/actuate-to-bi-publisher-reports.html

  • Stored Procedure used as a data source for an Apex report

    Just wondering whether anyone has used a Stored Procedure as the data source for an Apex report. An option to select Stored Procedures(s) as the data source does not appear within the IDE (only displays Table, Views, Functions).
    Do you have to return the definition of the Stored Procedure via a function ... if so, how is this done ?
    Thank you.

    >
    Welcome to the forum: please read the FAQ and forum sticky threads (if you haven't done so already), and update your profile with a real handle instead of "920338".
    When you have a problem you'll get a faster, more effective response by including as much relevant information as possible upfront. This should include:
    <li>Full APEX version
    <li>Full DB/version/edition/host OS
    <li>Web server architecture (EPG, OHS or APEX listener/host OS)
    <li>Browser(s) and version(s) used
    <li>Theme
    <li>Template(s)
    <li>Region/item type(s)
    With APEX we're also fortunate to have a great resource in apex.oracle.com where we can reproduce and share problems. Reproducing things there is the best way to troubleshoot most issues, especially those relating to layout and visual formatting. If you expect a detailed answer then it's appropriate for you to take on a significant part of the effort by getting as far as possible with an example of the problem on apex.oracle.com before asking for assistance with specific issues, which we can then see at first hand.
    Just wondering whether anyone has used a Stored Procedure as the data source for an Apex report. An option to select Stored Procedures(s) as the data source does not appear within the IDE (only displays Table, Views, Functions).
    Do you have to return the definition of the Stored Procedure via a function ... if so, how is this done ? When asking a question about "reports" it's firstly essential to differentiate between standard and interactive reports. Standard reports can be based on tables, views, SQL queries, or PL/SQL function blocks that return the text of a SQL query. Interactive reports can only be based on a SQL query.
    "Stored Procedures" are therefore not an option (unless you are using the term loosely to describe any PL/SQL program unit located in the database, thus including functions). What would a procedure used as the source of a report actually do? Hypothetically, by what mechanisms would the procedure (a) capture/select/generate data; and (b) make this data available for use in an APEX report? Why do you want to base a report on a procedure?

  • Dynamic Date Variant for SAP Job

    Hi Guru
    We have a program to be ran in the Background .
    I am unable to create a Variant for Date ( Current year Jan 01st to  Current Date).
    Could you please advice how to create a Variant with Dynamic Date Calculation for above date range.
    Thanks in Advance.
    Thanks
    Ravi

    Hi,
    I guess that you know how manage dynamic dates in a variant. (Please, tell me if you need help about it)
    You can try with two DATUM type fields in the ABAP program. Fix the first one with a fixed date u201901.01.2009u2019 and the second one will be fixed with the dynamic date u2018Current Dateu2019
    Regards,
    OLA

  • How to schedule an abap report program to run every day, weekend etc..

    Hi,
    I want to schedule an abap report program to run every day, week, fortnight or month and the output to be redirected to the printer. How to achieve this ?
    thanks

    Hi,
    go to t.code sm36 there give the name of the program which u want to eecute in background if u want u can give periodic that depends upon ur requirement from there in sm37 u can check the stauts and directly print from there
    hope i am clear to u
    plzz reward if it is useful...

  • An old report gets reprinted every day

    Hello all,
    We have an application that based on Oracle Reports and Forms.
    Now, one of the old reports, originally printed 6 months ago, gets reprinted every day.
    We don't have any ideas why. No one on purpose does it
    I was wondering if any of you have experienced the same issue.
    Thank you, Sonya

    By report you very likely mean report output, or report result?
    If so, looks like the report has been scheduled to run every day, and the start date was set 6 month ahead. Someone's error, or something. See your application manual on how to schedule / unschedule / view scheduled reports.

  • Dba_job that runs every saturday?

    There is a bug in oracle 10.1.0.3 that causes issues when running the default analyzer with dbms_scheduler. Oracle records that I drop this and run it as a dba_job.
    how do I scheduler it to run every saturday at 11 PM?
    declare
      vout integer;
    begin
    dbms_job.submit(job=>vout,
    what=>'begin dbms_stats.gather_database_stats(cascade => TRUE,method_opt => ''FOR ALL COLUMNS SIZE AUTO'',
    degree=>8 ); end;',next_date=>to_date('11072009 23:00','DDMMYYYY HH24:MI'),
    interval=>next_day(trunc(sysdate),'SATURDAY')+0/24);
    end;
      2    3    4    5    6    7    8    9  declare
    ERROR at line 1:
    ORA-23319: parameter value "18-JUL-09" is not appropriate
    ORA-06512: at "SYS.DBMS_JOB", line 57
    ORA-06512: at "SYS.DBMS_JOB", line 134
    ORA-06512: at line 4

    Can you use crontab command ?
    I think this will help and with less headache.
    In your case it would be
    0 23 * * 6 script ,path
    Check this for more info.
    http://www.adminschoice.com/docs/crontab.htm
    Cheers
    Edited by: [email protected] on Jul 13, 2009 2:42 PM

  • I ma using Firefox 4 in widows xp 32 bit, Everything was working fine in Firefox 3.x series, but after installing to Firefox 4 i am constantly getting this "not responding" by Firefox for like 5-10 seconds , almost every day.

    Hi, i ma using Firefox 4 in widows xp 32 bit,
    Everything was working fine in Firefox 3.x series, but after installing to Firefox 4 i am constantly getting this "not responding" by Firefox for like 5-10 seconds , almost every day.

    Hi, i ma using Firefox 4 in widows xp 32 bit,
    Everything was working fine in Firefox 3.x series, but after installing to Firefox 4 i am constantly getting this "not responding" by Firefox for like 5-10 seconds , almost every day.

  • Variable dates for a scheduling report

    Hi,
    My report query has "between..and" date clause in WHERE condition.
    I am planning to use the same report to schedule daily, weekly and monthly.
    1. If user schedule a report daily then query where clause should be
    trandate between sysdate - (sysdate-1)
    2. If user schedule a report weekly then query where clause should be
    trandate between sysdate - (sysdate-7).
    3. If user schedule a report monthly then query where clause should be
    trandate between sysdate - (sysdate-30).
    How can we dynamically change the variable dates using Oracle reports using scheduler?
    I thought of using lexical parameters but our users doesn't like to give any other values except scheduling report through scheduler.
    Please advise.

    Hi Prasad,
    By Scheduler probably you mean the Reports Queue Manager. If you use the Reports QM, you may not be able to access the scheduling parameters in your report / query.
    However, you can design a simple HTML parameter form where the user will have 3 values in the drop-down (daily, weekly, monthly). Depending on what is selected, you can construct a reports command line where you pass BOTH
    schedule=.....
    and
    p_where_clause=....
    The "schedule" parameter will schedule the report in the server, while the other parameter "p_where_clause" will determine what to use in the report query. So the user makes only one selection and you pass both parameters based on the selection.
    Navneet.

  • "Dynamic Date" in a suscribed SSRS report

    I need to add a filter to a report which will then function as a subscription.
    I need the report to generate data from 6am on a previous day to 6am on the current day.  
    The parameter I have created gives the StartDate and EndDate fields.  These need to auto fill in the report so the subscription service will use the default settings.  This report will run at 8am on the current day.  
    When I go to enter an expression for the default value on StartDate, I know it has to have a today -1 code, but then how do you get it to >=6am?
    When I go to enter an expression for the default value on EndDate, I know it has to have a today () code, but then how do you get it to stop at >6AM?
    Can anyone help me with these default value expressions as I will be using them in a bunch of reports I'm going to be creating.
    Thanks!

    Hi Jon Mensching,
    According to your description that you want to add a filter to filter the report which have the date between an dynamic StartDate and EndDate, StartDate at 6am of the (current day-1) and EndDate is at 6am of the current day, right?
    I have tested on my local environment and we can create an dataset to get the dynamic StartDate and EndDate and then create two parameter which default value specified as “Get values from a query”, finally, we can add the filter to filter the date between
    the startdate and the enddate.
    Details steps below for your reference:
    Create the Dateset2 using this query to get the dynamic startdate and enddate(take reference of the query by Uri Dimant’s )
    Query:
    SELECT (DATEADD(HOUR, 06, DATEADD(DAY, DATEDIFF(DAY, '20010101',
    GETDATE()-1), '20010101'))) as startdate,
    (DATEADD(HOUR, 06, DATEADD(DAY, DATEDIFF(DAY, '20010101',
     GETDATE()), '20010101')))as enddate
    Create two parameters “startdate” and “enddate” and spacify the default value “Get values from a query” (DateSet2)
    Add the filter of main DataSet(DataSet1) like below:
    If you still have any question, please feel free to ask.
    Regards
    Vicky Liu

  • Using a Web Service as a data provider for a Crystal Report

    <p>I&#39;m trying to write a Crystal Reports XI report that uses a Web Service as the data provider.  I have a Web Service written in ColdFusion that looks like this.<br /><br /><cfcomponent displayName="FindEmployee" ><br />   <cffunction name="FindEmployeeSort" access="remote"          <br />               returnType="xml" output="false"><br />      <cfdump var=form><br />      <cfset myXML = ""><br />       <!--- FindEmployeeSort body ---><br />       <cfquery name="EmployeeQuery" datasource="Production"><br />           Select * from employee<br />          <cfif isdefined(&#39;form.lastname&#39;)><br />             WHERE lastname LIKE &#39;%#form.lastname#%&#39; <br />          </cfif><br />           Order by lastname asc <br />        </cfquery><br />     <cfreturn EmployeeQuery>  <br />   </cffunction><br /></cfcomponent><br /><br />I can get the web service to work from a ColdFusion page (either locally or on a remote server).</p><p>When I try to create the CR data source, I get the following error:</p><p>Crystal Reports<br />! Logon Failed.<br />Details: Cannot find correspondign table information in the XML file</p><p>The steps I took were:<br />* Choose XML from the "Avalable Data Sources"<br />* Choose "Use Web Service Data Source"<br />* Choose "Use HTTP(S) WSDL" with a url of <a href="http://host/directory/FindEmployee.cfc?wsdl">http://host/directory/FindEmployee.cfc?wsdl</a><br />* Leave the "HTTP(S) Web Service User ID:" and "HTTP(S) Web Service Password:" parameters blank<br />* Accept the defaults for Services, Ports, and Methods.  They are respectively FindEmployee, FindEmployee.cfc and FindEmployeeSort.<br />* Then get the error</p><p>The most likely candidate to me is the user id and password, but I have no idea what to use.  I didn&#39;t have to set any login information up in the ColdFusion pages that I used to test the Web Service.</p><p>Any ideas where to go from here?</p><p>Thanks,</p><p>Brian</p>

    Please re-post if this is still an issue to the Java Development - Crystal Reports Forum or purchase a case and have a dedicated support engineer work with you directly

  • Date parameters for Date range

    Hi,
    I got a report with 2 parameters From Date and To Date and i have 2 columns items in the report absence start date and absence end date.
    i have to make sure that the date range satisfies all case's
    what is the best way that I can these validation rules in discoverer on these dates...?
    case's are something like this:
    1 (absence start date > from date; absence end date > to date)
    2 (absence start date > from date; absence end date < to date)
    3 (absence start date < from date; absence end date > to date)
    4 (absence start date > from date; absence end date < to date)
    Any help would be really appreciated.

    Using conditions in Discoverer is just like specifying a where clause in SQL with AND and OR. You should be able to use conditions for what is being described below.
    Are you not able to do that using conditions in your report ?

  • How to configure Dynamic Data Connection for Business View

    Hi,
    How can we configure Dynamic Data connection that we can save the profile of the connection to somewhere that we do not need to enter it everytime when we refresh the report?
    thanks and regards
    nora

    Hi James,
    Thanks for the reply. Its solved now. For anybody if interested you can set the dynamic email address either i) having it as part of payload - In this case use the xpath to query the payload varaible ii) use identity service - follow the following steps
    1.Create a user in Application enterprise manager/also you can use a existing account, if u are creating a new one assign the correct role
    2. In either case edit the user-properties.xml(bpel/system/services/config) file for the corresponding user and add an attribute called email
    3. Bounce the server for this changes to take effect
    4. In the notification properties in the to address use ids:getUserProperty and pass the attribute name

  • Trying to programmatically set the data-source for a Crystal reports report.

    I've got the following existing procedure that I need to add to in order to programmatically set the data-source (server, database, username, and password) for a Crystal reports report.
     I added the connectionInfo parts, but can’t figure out how to attach this to the existing
    this._report object.
    This is currently getting the connection data from the report file, but I now need to populate this connection data from a 'config.xml' text file.
    Am I trying to do this all wrong?
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using CrystalDecisions.CrystalReports.Engine;
    using WGS.Reports.Reports;
    using CrystalDecisions.Shared;
    using WGS.Reports.Forms;
    namespace WGS.Reports
    public class ReportService
    ReportClass _report;
    ParameterFields paramFields;
    ConnectionInfo connectionInfo; // <- I added this
    public ReportService()
    public void DisplayReport(string reportName, int allocationNo)
    if (reportName.ToLower() == "allocationexceptions")
    this._report = new AllocationExceptions();
    PrepareConnection(); // <- I added this
    PrepareAllocationExceptionReport(allocationNo);
    this.DisplayReport();
    private void PrepareConnection() // <- I added this
    //test - these will come from the config.xml file
    this.connectionInfo = new ConnectionInfo();
    this.connectionInfo.ServerName = "testserv\\test";
    this.connectionInfo.DatabaseName = "testdb";
    this.connectionInfo.UserID = "testuser";
    this.connectionInfo.Password = "test";
    this.connectionInfo.Type = ConnectionInfoType.SQL;
    private void PrepareAllocationExceptionReport(int allocationNo)
    this.paramFields = new ParameterFields();
    this.paramFields.Clear();
    ParameterField paramField = new ParameterField { ParameterFieldName = "@AllocationNo" };
    ParameterDiscreteValue discreteVal = new ParameterDiscreteValue { Value = allocationNo };
    paramField.CurrentValues.Add(discreteVal);
    paramFields.Add(paramField);
    private void DisplayReport()
    frmReportViewer showReport = new frmReportViewer();
    showReport.ReportViewer.ReportSource = this._report;
    showReport.ReportViewer.ParameterFieldInfo = paramFields;
    showReport.ShowDialog();
    showReport.Dispose();
    Any help would be much appreciated.

    Hi Garry,
    Please post SAP Crystal Reports questions in their own forums here:
    SAP Crystal Reports, version for Visual Studio
    We don't provide support for this control now. Thanks for your understanding.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for