Date ranges with OLE DB

Post Author: georgeb
CA Forum: Data Connectivity and SQL
Does anyone know if the issue with date ranges in OLE DB reports using Visual Foxpro databases has been resolved in Crystal Reports 10?
Currently all OLE DB reports that use date ranges crash with:
Failed to open a rowset.Details: ADO Error Code: 0x80004005Source: Microsoft OLE DB Provider for Visual FoxProDescription: SQL: Column 'DATETIME' is not foundNative Error: 806We referred this to Business Objects some time ago and their comment was that they do not supportVisual FoxPro ...
Any assistance would be appreciated.

Here is how you can do datetime range with EOMONTH:
SELECT Count(DISTINCT[form number]) AS OutofFunding
FROM [dbo].[newview]
WHERE [cohort desc] IN ( 'Apprenticeships' )
AND [expected end] > Eomonth(Getdate(), -1)
AND [expected end] < Dateadd(dd, 1, Eomonth(Getdate(), 4));
BLOG on datetime ranges:
http://www.sqlusa.com/bestpractices2008/between-dates/
Kalman Toth Database & OLAP Architect
SQL Server 2014 Design & Programming
New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

Similar Messages

  • Compute Date Range with SQL Statement

    I'm sure there is a way to do this in SQL, but I cannot figure it out. I can write a PL/SQL script to do it, but would prefer using a SQL Statement. My database is Oracle Database 10.2.0.4.0.
    I have a table that contains information such as the employee number, department id, and the effective date of when the person started in that department. There is data in another table that I want to update their department number in based on their effective date range. If I could figure out how to select the effective date range correctly, I can do the rest.
    I have data such as:
    EMP_ID DEPT_NO EFFECTIVE
    101 1000 1/15/2001
    101 1050 5/24/2005
    101 2010 6/8/2008
    101 1000 8/2/2010
    I want to write a SELECT statement that returns something like this where the END_DATE is the day before the EFFECTIVE date and the last record does not have an END_DATE because they are still assigned to that department. Also, the first record in the column, I don't want to select a DEPT_NO because the effective date logic was added in January 2001 so if a person started back in 1985 they could have switched departments zero to many times so I'm not going to update any data for that period:
    EMP_ID DEPT_NO EFFECTIVE END_DATE
    101 1/14/2001
    101 1000 1/15/2001 5/23/2005
    101 1050 5/24/2005 6/7/2008
    101 2010 6/8/2008 8/1/2010
    101 1000 8/2/2010
    Below is a script to create the data in a temp table that can be used to write a SELECT statement on. I have added two employee records with different dates.
    create table temp_activity
    (emp_id number(12),
    dept_no number(12),
    effective date);
    INSERT INTO temp_activity
    (EMP_ID,DEPT_NO,EFFECTIVE)
    VALUES
    (101,1000,to_date('1/15/2001','MM/DD/YYYY'))
    INSERT INTO temp_activity
    (EMP_ID,DEPT_NO,EFFECTIVE)
    VALUES
    (101,1050,to_date('5/24/2005','MM/DD/YYYY'))
    INSERT INTO temp_activity
    (EMP_ID,DEPT_NO,EFFECTIVE)
    VALUES
    (101,2010,to_date('6/8/2008','MM/DD/YYYY'))
    INSERT INTO temp_activity
    (EMP_ID,DEPT_NO,EFFECTIVE)
    VALUES
    (101,1000,to_date('8/2/2010','MM/DD/YYYY'))
    INSERT INTO temp_activity
    (EMP_ID,DEPT_NO,EFFECTIVE)
    VALUES
    (102,1040,to_date('1/15/2001','MM/DD/YYYY'))
    INSERT INTO temp_activity
    (EMP_ID,DEPT_NO,EFFECTIVE)
    VALUES
    (102,2000,to_date('6/16/2006','MM/DD/YYYY'))
    Any help is appreciated. This is probably easy, but I cannot get my brain wrapped around it.
    Thanks - mike

    select  emp_id,
            dept_no,
            effective,
            end_date
      from  (
              select  emp_id,
                      dept_no,
                      effective,
                      lead(effective) over(partition by emp_id order by effective) - 1 end_date,
                      row_number() over(partition by emp_id order by effective) rn
                from  temp_activity
             union all
              select  emp_id,
                      null dept_no,
                      null effective,
                      min(effective) - 1 end_date,
                      0 rn
                from  temp_activity
                group by emp_id
      order by emp_id,
               rn
        EMP_ID    DEPT_NO EFFECTIVE  END_DATE
           101                       01/14/2001
           101       1000 01/15/2001 05/23/2005
           101       1050 05/24/2005 06/07/2008
           101       2010 06/08/2008 08/01/2010
           101       1000 08/02/2010
           102                       01/14/2001
           102       1040 01/15/2001 06/15/2006
           102       2000 06/16/2006
    8 rows selected.
    SQL> SY.

  • Date Ranges with EOMONTH

    Hi I'm look
    for a date ranges query, any help would be greatly appreciated<o:p></o:p>
    Ie
    01/06/2014 to 30/06/2014<o:p></o:p>
    SELECT
    count(DISTINCT[Form Number]) as OutofFunding
    FROM [dbo].[NEWVIEW]
    WHERE [Cohort Desc] IN ('Apprenticeships')
    AND [Expected End] > EOMONTH(GETDATE(), -1) <o:p></o:p>

    Here is how you can do datetime range with EOMONTH:
    SELECT Count(DISTINCT[form number]) AS OutofFunding
    FROM [dbo].[newview]
    WHERE [cohort desc] IN ( 'Apprenticeships' )
    AND [expected end] > Eomonth(Getdate(), -1)
    AND [expected end] < Dateadd(dd, 1, Eomonth(Getdate(), 4));
    BLOG on datetime ranges:
    http://www.sqlusa.com/bestpractices2008/between-dates/
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Display date range with given week no

    Can anyone please suggest on how to display Date range when wek no is given in APEX 4.0.2?
    Example: given week no as 20 then I need to show week_start_date as 7/18/2011 and week_end_date as 7/25/2011 .
    Thanks

    maybe this could help you on the way to a solution:
    with dates as
        ( select dat, to_char(dat+1, 'iw') week
        from (select to_date('01-01-2011', 'DD-MM-YYYY') + rownum dat
        from all_objects)
        where rownum < 1000)
    select week, min(dat), max(dat)
    from dates
    where week = 20
    group by week
    order by week;You have to check which format for week you want to use: WW (first week starts at the 1st of January) IW (ISO week number)
    see also: http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:7482139067917

  • Data between Date Range with Business Days only

    Hi All,
    We have a requirement that we need to retrieve data between a data range, providing From date and To date as input.
    We also have the option to Include Business Days Only through a check box which will be passed to CR 2008 through a report frame work.
    Can some one help me how to display the report data within the Date Range entered and that includes only Business Days.
    Thanks in advance for the help.
    Regards,
    Naresh.

    try this formula. Lets if your date range parameter is {?date} then try this formula
    @startdate:
    if datepart('w',minimum({?date}))=7 then
    minimum({?date})+2
    else if datepart('w',minimum({?date}))=1 then
    minimum({?date})+1
    else
    minimum({?date})
    @enddate
    if datepart('w',maximum({?date}))=7 then
    maximum({?date})+2
    else if datepart('w',maximum({?date}))=1 then
    maximum({?date})+1
    else
    maximum({?date})
    regards,
    Raghavendra

  • Export Mail to pst between date range with Messagekind eq Email

    Exchange 14.2 247.5
    I am trying to export all mail from a piped list of mailboxes but only between two dates. I can do one or the other, but not combine both contentfilters - can anyone offer any advice as to what I'm doing wrong? I've played with different combinations of
    brackets but I can't get it do do an -and for some reason. My spreadsheet has columns for alias and pstpath - this part is fine, I just can't get it to evaulate both contentfilters. My short script:
    foreach ($i in (Import-Csv c:\temp\export\mailtest.csv)) { 
    New-MailboxExportRequest -Mailbox $i.Alias -FilePath $i.PSTpath -ContentFilter {(Received -lt '07/18/2014') -and (Received -gt '06/18/2014')} {MessageKind -eq Email}
    I'm also running a script to shift all calendars and contacts (not date limited) to pst but am running this seperately. If these can be combined then great, but I'm happy to run two commands.
    THanks
    James.

    No joy still with that either. Running Get-MailboxExportRequestStatistics -Identity MaibloxName\MailboxExport
    -IncludeReport | Format-List gives the error message:
    AssociatedMessagesCopyOption  : DoNotCopy
    BatchName                     :
    ContentFilter                 : ((((Received -lt '18/07/2014 12:00:00 AM') -and (Received -gt '18/06/2014 12:00:00 AM')
                                    )) -and (MessageKind -eq 'Email'))
    ContentFilterLanguage         :
    BadItemLimit                  : 0
    BadItemsEncountered           : 0
    QueuedTimestamp               : 19/07/2014 3:18:11 PM
    StartTimestamp                :
    LastUpdateTimestamp           : 19/07/2014 3:18:15 PM
    CompletionTimestamp           :
    SuspendedTimestamp            :
    OverallDuration               : 00:00:15
    TotalSuspendedDuration        :
    TotalFailedDuration           : 00:00:12
    TotalQueuedDuration           : 00:00:03
    TotalInProgressDuration       : 00:00:00
    TotalStalledDueToHADuration   :
    TotalTransientFailureDuration :
    MRSServerName                 :
    EstimatedTransferSize         : 0 B (0 bytes)
    EstimatedTransferItemCount    : 0
    BytesTransferred              : 0 B (0 bytes)
    BytesTransferredPerMinute     :
    ItemsTransferred              : 0
    PercentComplete               : 0
    PositionInQueue               :
    FailureCode                   : -2146233088
    FailureType                   : InvalidContentFilterPermanentException
    FailureSide                   :
    Message                       : Error: ContentFilter is invalid. The value "18/07/2014 12:00:00 AM" could not be conver
                                    ted to type System.DateTime. --> The value "18/07/2014 12:00:00 AM" could not be conver
                                    ted to type System.DateTime.
    FailureTimestamp              : 19/07/2014 3:18:15 PM
    FailureContext                :
    I am in AU using English (australia) and so using dd/mm/yyyy short date format but understand that this is irrelevant and we use mm/dd/yyyy for powershell operations. 
    The command I am using is:
    New-MailboxExportRequest -Mailbox $i.Alias -FilePath $i.PSTpath -ContentFilter {((Received -lt '07/18/2014') -and (Received -gt '06/18/2014') -and (MessageKind -eq "Email"))}
    I don't understand why this is failing...

  • Selecting missing date range with previous records value

    Hello,
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    SET DEFINE OFF;
    create table t(NBR_OF_S number, NBR_OF_C number, S_DATE date);
    Insert into  T
       (NBR_OF_S, NBR_OF_C, S_DATE)
    Values
       (34, 40, TO_DATE('05/01/2012 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into  T
       (NBR_OF_S, NBR_OF_C, S_DATE)
    Values
       (27, 29, TO_DATE('03/01/2012 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into  T
       (NBR_OF_S, NBR_OF_C, S_DATE)
    Values
       (21, 23, TO_DATE('12/01/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into  T
       (NBR_OF_S, NBR_OF_C, S_DATE)
    Values
       (19, 20, TO_DATE('10/01/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into  T
       (NBR_OF_S, NBR_OF_C, S_DATE)
    Values
       (18, 19, TO_DATE('09/01/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into  T
       (NBR_OF_S, NBR_OF_C, S_DATE)
    Values
       (17, 17, TO_DATE('08/01/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into  T
       (NBR_OF_S, NBR_OF_C, S_DATE)
    Values
       (16, 16, TO_DATE('06/01/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into  T
       (NBR_OF_S, NBR_OF_C, S_DATE)
    Values
       (9, 9, TO_DATE('12/01/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into  T
       (NBR_OF_S, NBR_OF_C, S_DATE)
    Values
       (5, 5, TO_DATE('11/01/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into  T
       (NBR_OF_S, NBR_OF_C, S_DATE)
    Values
       (2, 2, TO_DATE('01/01/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    COMMIT;
    SQL> select * from t order by 3 desc;
      NBR_OF_S   NBR_OF_C S_DATE
            34         40 01-MAY-12
            27         29 01-MAR-12
            21         23 01-DEC-11
            19         20 01-OCT-11
            18         19 01-SEP-11
            17         17 01-AUG-11
            16         16 01-JUN-11
             9          9 01-DEC-10
             5          5 01-NOV-10
             2          2 01-JAN-10
    10 rows selected.I want the output like as follows, all those missing date i need to carry on the last one's number
      NBR_OF_S   NBR_OF_C S_DATE
            34         40 01-MAY-12
            27         29 01-APR-12
            27         29 01-MAR-12
            21         23 01-FEB-12
            21         23 01-JAN-12
            21         23 01-DEC-11
            19         20 01-NOV-11
            19         20 01-OCT-11
            18         19 01-SEP-11
            17         17 01-AUG-11
            16         16 01-JUL-11
            16         16 01-JUN-11
             9          9 01-MAY-11
             9          9 01-APR-11
             9          9 01-MAR-11
             9          9 01-FEB-11
             9          9 01-JAN-11
             9          9 01-DEC-10
             5          5 01-NOV-10
             2          2 01-OCT-10
             2          2 01-SEP-10
             2          2 01-AUG-10
             2          2 01-JUL-10
             2          2 01-JUN-10
             2          2 01-MAY-10
             2          2 01-APR-10
             2          2 01-MAR-10
             2          2 01-FEB-10
             2          2 01-JAN-10Any help would be greatly appreciate.
    Note: The date value I have created for this sample is monthly, based on the condition the data value I may need to generate weekly also. That's Monthly or weekly either one
    Thanks,

    And what is AMT? You didn't provide such column in your original post. Anyway, MODEL solution based on original post:
    select  nbr_of_s,
            nbr_of_c,
            s_date
      from  t
      model
        partition by(rowid)
        dimension by(1 d)
        measures(
                 nbr_of_s,
                 nbr_of_c,
                 s_date,
                 months_between(lag(s_date) over(order by s_date desc),s_date) cnt
        rules(
              nbr_of_s[for d from 1 to cnt[1] increment 1] = nbr_of_s[1],
              nbr_of_c[for d from 1 to cnt[1] increment 1] = nbr_of_c[1],
                s_date[for d from 1 to cnt[1] increment 1] = add_months(s_date[1],cv(d) - 1)
      order by s_date desc
      NBR_OF_S   NBR_OF_C S_DATE   
            34         40 01-MAY-12
            27         29 01-APR-12
            27         29 01-MAR-12
            21         23 01-FEB-12
            21         23 01-JAN-12
            21         23 01-DEC-11
            19         20 01-NOV-11
            19         20 01-OCT-11
      NBR_OF_S   NBR_OF_C S_DATE   
            18         19 01-SEP-11
            17         17 01-AUG-11
            16         16 01-JUL-11
            16         16 01-JUN-11
             9          9 01-MAY-11
             9          9 01-APR-11
             9          9 01-MAR-11
             9          9 01-FEB-11
      NBR_OF_S   NBR_OF_C S_DATE   
             9          9 01-JAN-11
             9          9 01-DEC-10
             5          5 01-NOV-10
             2          2 01-OCT-10
             2          2 01-SEP-10
             2          2 01-AUG-10
             2          2 01-JUL-10
             2          2 01-JUN-10
      NBR_OF_S   NBR_OF_C S_DATE   
             2          2 01-MAY-10
             2          2 01-APR-10
             2          2 01-MAR-10
             2          2 01-FEB-10
             2          2 01-JAN-10
    29 rows selected.
    SQL> SY.
    Edited by: Solomon Yakobson on Jun 11, 2012 1:34 PM

  • Continious data range algorithm

    I have in my database table 2 important date columns: StartDate (Not null) and EndDate(Allowed Null).
    I want to ensure that all records in the table would always create perfect contiues date ranges with no holes inside.
    Wor example there may not be records [1-may..1-may, 3-may-...] because there would be a hole [2-may...2-may]. Holes are not allowed.
    And overlapping is not allowed, for example [1-may..1-may, 1-may-2may, 3-may-...] is not allowed because overlapping occures on day 1-may. Overlapping and holes are not allowed. But it is allowed that table has no records at all. But all DML manipulations with existing records must ensure that overlapping and holes won't occur.
    How to write such check? How to ensure that data ranges would stay continous with no holes and no overlaps?
    Oracle 11g.

    You're setting the wrong value for the start of a group when there is no (null) lagging end date. In my example I set the value to 0 when it was null as I was expecting each group to start at 1. In your case you've set the date to 1/1/1900 which isn't necessarily the day before the first start date of the group. Instead just default it to the start date - 1 to force a match...
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select 1 as id, to_date('01.04.2013', 'DD.MM.YYYY') as val1, to_date('04.04.2013', 'DD.MM.YYYY') as val2 from dual union all
      2             select 1, to_date('05.04.2013', 'DD.MM.YYYY'), to_date('06.04.2013', 'DD.MM.YYYY') from dual union all
      3             select 1, to_date('07.04.2013', 'DD.MM.YYYY'), null from dual union all
      4             select 2, to_date('01.04.2013', 'DD.MM.YYYY'), to_date('03.04.2013', 'DD.MM.YYYY') from dual union all
      5             select 2, to_date('04.04.2013', 'DD.MM.YYYY'), to_date('07.04.2013', 'DD.MM.YYYY') from dual union all
      6             select 2, to_date('09.04.2013', 'DD.MM.YYYY'), to_date('12.04.2013', 'DD.MM.YYYY') from dual union all
      7             select 2, to_date('13.04.2013', 'DD.MM.YYYY'), null from dual union all
      8             select 3, to_date('01.04.2013', 'DD.MM.YYYY'),to_date('03.04.2013', 'DD.MM.YYYY') from dual union all
      9             select 3, to_date('04.04.2013', 'DD.MM.YYYY'), null from dual union all
    10             select 4, to_date('01.04.2013', 'DD.MM.YYYY'), to_date('01.04.2013', 'DD.MM.YYYY') from dual union all
    11             select 4, to_date('01.04.2013', 'DD.MM.YYYY'), null from dual
    12            )
    13  --
    14  select id
    15        ,val1 as "start"
    16        ,val2 as "end"
    17        ,lag(val2) over (partition by id order by val1)
    18        ,case when
    19             nvl(lag(val2) over (partition by id order by val1),val1-1) != val1-1 then
    20                   'hole or overlap'
    21              else null
    22         end as chk
    23  from t
    24* order by 1, 2
    25  /
            ID start                end                  LAG(VAL2)OVER(PARTIT CHK
             1 01-APR-2013 00:00:00 04-APR-2013 00:00:00
             1 05-APR-2013 00:00:00 06-APR-2013 00:00:00 04-APR-2013 00:00:00
             1 07-APR-2013 00:00:00                      06-APR-2013 00:00:00
             2 01-APR-2013 00:00:00 03-APR-2013 00:00:00
             2 04-APR-2013 00:00:00 07-APR-2013 00:00:00 03-APR-2013 00:00:00
             2 09-APR-2013 00:00:00 12-APR-2013 00:00:00 07-APR-2013 00:00:00 hole or overlap
             2 13-APR-2013 00:00:00                      12-APR-2013 00:00:00
             3 01-APR-2013 00:00:00 03-APR-2013 00:00:00
             3 04-APR-2013 00:00:00                      03-APR-2013 00:00:00
             4 01-APR-2013 00:00:00 01-APR-2013 00:00:00
             4 01-APR-2013 00:00:00                      01-APR-2013 00:00:00 hole or overlap
    11 rows selected.

  • Duplicate report title for every date where records are found in date range

    Hi,
    I have a developed a report that lists multiple entries by date range with a page break separating each date. What I would like to include now is a report title which only appears once for each date, and separated by page break.
    Example:
    (Business Unit)
    (Address)
    (Report Title)
    (Date)
    Entry 1
    Entry 2
    Entry 3
    Entry 4
    Entry 5
    Entry 6
    Entry 7
    (Business Unit)
    (Address)
    (Report Title)
    (Date)Entry 1

    Hi Camelbak2113,
    According to your description, it seems that you want to eliminate the duplicate report title for every date. If in this scenario, I suggest that we can try to add a group grouped on date range, and then add a child group grouped on report title. Then add
    page breaks between each instance of date range group.
    If I have something misunderstood, please provide us more information about the report. Such as provide us some screenshots about the report with sample data. So that we can make further analysis and help you out.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • EasyDMS - search by date range for characteristics of type date

    Hi Folks,
    I have a characteristic of type date in the additional data of a DMS document. If I enter the date (for example validity date) as 08/31/2009 and search using cv04n and give a date range for the characteristic (i.e. 01/01/2009 - 12/31/2009), the search result will bring up the document.
    However, I cannot do this from the EasyDMS find function. I need to specify an exact date. This is not very helpful for user who need to find documents with a validity date between 01/01/2009 - 12/31/2009 for example. Is there a way users can search for date range in EasyDMS find function?
    Thanks,
    Lashan

    To search a date range with EasyDMS Client you have to set the registry key
    \HKEY_CURRENT_USER\Software\SAP\EasyDms\Generel\DateSearchPick to Value 0
    Then you can use the input field like in SAP-Gui. (01.01.2009-31.01.2009)
    If you set the value to 1 or the key is not defined you can only search for one specified date.
    If you don't find this key on your PC create it as dword.
    Maybe you must restart you PC for takeing effect.
    Hope this will help you.
    Regards Wolfgang

  • Supress details in subreport based on date ranges in main report

    I am using Crystal XI R2 and am working with Human Resources Data.
    The main report is grouped on and generates a list of temporary teaching positions like this:
    Smith, John
         FTE_____Start Date_______End Date
          .3 ______09/01/2007______10/20/2007
          .2 ______10/05/2007 ______04/15/2008
          .2 ______04/01/2008 ______06/30/2008
    The subreport (generated from a different source, but linked to main report on ) generates a list of days the employee worked as a Teacher on Call:
         TOC Date______ Portion of Day Worked
         09/05/2007______1.0
         09/19/2007______0.6
         10/08/2007______0.4
         10/09/2007______1.0
          04/08/2008______0.6
          04/18/2008______1.0
    Employees are granted seniority for TOC days worked, EXCEPT when they are already employed in a Teaching position >=.4 FTE  (because they are already granted full seniority for that period), so I need to be able to suppress records that fall within date ranges listed in the Main Report where the combine FTE is >=.4.     
    I believe this question has two parts:
    1. how do I evaluate the date ranges to combine overlapping periods?  Results would look like this... (I don't need to be able to see this, but I'm assuming I'd have to create a date range with the results in order to answer question #2 - but I haven't worked much with ranges.)
        FTE_____Start Date______End Date
          .3______09/01/2007______10/04/2007
          .5______10/05/2007______10/20/2007 
          .2______10/21/2007______03/31/2008
          .4______04/01/2008______04/15/2008
          .2______04/16/2008______06/30/2008
    2. how do I supress the TOC dates in the Subreport that fall within the start and end dates of all the employee's positions >= 0.4 FTE ?  Supreport results for this example would look like this...
         TOC Date______ Portion of Day Worked
         09/05/2007______1.0
         09/19/2007______0.6
         04/18/2008______1.0
    (I will sum the "portion" values and mulitply them by a constant variable to complete the seniority calculation.)
    Thank you in advance for any assistance you may be able to provide!

    Thanks for your help Graham, I have continued to work with this and I took the BO Crystal III course.  Your suggestions gave me a sense of  direction.
    I was not able to share a date range array with the subreport (kept getting error messages saying "call BO" , but I WAS able to share the startdate array and the enddate array.  I also shared the fte values array. 
    I had wanted to use a loop  to check
    if TOCdate in startarray[x] to endarray[x]
    then ftearray[x]
    and  sum the new range of fte[x] values so that I could suppress any TOCdates where fte was >=0.4.   But I couldn't quite get there, I kept coming up with formulas that displayed only the first value or the last or zero.
    So I used the following formula for each index (returnindex value had to be changed for each case), then added them all together.
    shared datevar array startArray;
    shared datevar array endArray;
    shared numbervar array FTEArray;
    local numbervar arraylength:= ubound(startArray);
    local numbervar i;
    local numbervar returnindex :=-1;
    If arraylength >=1 then
    if not({AAATDDET.Date} in startarray[1]to endarray[1])then
    0 else
    if {AAATDDET.Date} in startarray[1]to endarray[1] then
    (returnIndex:= i;);
    i:=i+1;
    if returnindex =0 then
    ftearray[1]

  • Date Range for Limit Shopping Carts in SRM 7

    Classic Scenario:
    1. Create a Limit SC with Between Dates (date Range) with a sUpplier
    2. PO is created in BE only with a delivery date.
    I would like to get the date range in the header of the PO. Thoughts!
    Thanks

    Here you go.
    Use below SAP note for getting from and TO dates populated in ECC PO from SRM SC.
    This note will be released as part of SRM7 SP09.
    SRM 7
    Classic Scenario
    XI msg from SRM to ECC
    SAP note 1503941 and 1505317 in ECC and SRM respectively.
    Message Closed. Thanks
    Edited by: Netaji Gummadi on Sep 13, 2010 3:29 PM

  • Date Range at Reports Section

    Hi,
    I am doing some Reports and my requirement is to put a Date Range with default operator as Is Between.  This functionality works in Query Groups in dynamic filters where it shows From Date to End Date. I just wanted to know if this funcationlity works in Reports Section if so How ? For me it is not working.

    Hello,
    Unfortunately, this will not work in the Reports section.
    I was struggling with this and then I found out that the documentation states:
    "Range and List are only supported in the UI for filters in queries which are used in list page query groups and on the report scheduled task page."
    Regards,
    Bogdan

  • Spliting user entered date range into u201CFrom Date u201C and u201C To dateu201D-user exit

    Hi,
    In the query i have a created a popup variable for date range for which the processing type is customer exit. When the user exceutes the query he gets the popup for the date range with the default values. The default values are set one month backward.
    For example: if today is 5/19/2008, then the popup date range shows 4/19/2008 to 5/19/2008.
    Already there is an user exit written for the same.
    Now the requirement is i need to split From date and to date entered by user and use them in seperate selections to restrict the keyfigure in the keyfigure column of the query.
    Can anyone throw a light on this, how to go about?
    Shall i need to create two different variables from date and two date and populate the values, if yes how can i do that ?
    Thanks,
    Rani.
    Edited by: rani on May 19, 2008 10:22 AM

    Hello Rani,
                     Check this code,
    var1 is already existing variable with values from date and to date values.
    ztest1 is the first customer exit single variable,
    ztest2 is the second customer exit variable.
    ztest1 and ztest2 you can use these variables in the restricted keyfigures which you have mentioned.
    when 'ztest1'.
        if i_step = 2. "after the popup
          loop at i_t_var_range into loc_var_range
          where vnam = 'var1'.
            clear l_s_range.
            l_s_range-low = loc_var_range-low.
            l_s_range-sign = 'I'.
            l_s_range-opt = 'EQ'.
            append l_s_range to e_t_range.
            exit.
          endloop.
        endif.
    when 'ztest2'.
        if i_step = 2. "after the popup
          loop at i_t_var_range into loc_var_range
          where vnam = 'var1'.
            clear l_s_range.
            l_s_range-low = loc_var_range-high.
            l_s_range-sign = 'I'.
            l_s_range-opt = 'EQ'.
            append l_s_range to e_t_range.
            exit.
          endloop.
        endif.
    hope it helps,
    regards,
    karthik

  • How do I collapse contiguous Date Ranges in SQL?

    Hi,
    In the data below, I want to collapse the contiguous date ranges with the same value (3.7) into a single date range.  I have tried and tried to come up with something but am stuck.  Does anyone know how to accomplish?
    DECLARE @Have TABLE(B DATE, E DATE, R DECIMAL(18, 1))
    INSERT INTO @Have VALUES
    ('2014-08-22', '2014-12-31', 4.0)
    , ('2015-01-01', '2015-03-29', 3.7) -- same value, contingious date ranges
    , ('2015-03-30', '2015-03-31', 3.7) -- same value, contingious date ranges
    , ('2015-04-01', '2015-09-30', 4.0)
    SELECT * FROM @Have
    DECLARE @Want TABLE(B DATE, E DATE, R DECIMAL(18, 1))
    INSERT INTO @Want VALUES
    ('2014-08-22', '2014-12-31', 4.0)
    , ('2015-01-01', '2015-03-31', 3.7) -- want to collapse into 1 date range
    , ('2015-04-01', '2015-09-30', 4.0)
    SELECT * FROM @Want
    Thanks

    Hi tballard,
    The posts from Jingyang and Cooper would be perfect only in the case that there’s no date gap between your rows. In addition to their posts, if in any case there would be a gap, please refer my code below, which works in either case.
    DECLARE @Have TABLE(B DATE, E DATE, R DECIMAL(18, 1))
    INSERT INTO @Have VALUES
    ('2014-08-22', '2014-12-30', 3.7) --same value , date gap
    , ('2015-01-01', '2015-03-29', 3.7) -- same value, contingious date ranges
    , ('2015-03-30', '2015-03-31', 3.7) -- same value, contingious date ranges
    , ('2015-04-01', '2015-09-27', 4.0) --same value, date gap
    , ('2015-10-1', '2015-12-30', 4.0) --same value, date gap
    ;WITH CTE1 AS(
    SELECT H1.B B1,H1.E E1,H1.R R1,H2.B B2,H2.E E2,ISNULL(H2.R,0) R2,ROW_NUMBER() OVER(ORDER BY H1.B) RN FROM @HAVE H1 LEFT JOIN @HAVE H2 ON DATEDIFF(DAY,H1.B,H2.E)=-1
    CTE2 AS(
    SELECT B1,E1,R1 FROM CTE1 WHERE R1 != R2
    CTE3 AS(
    SELECT B1,E1,RN,B2 FROM CTE1 WHERE R1=R2
    CTE4 AS(
    Select min(B2) B, Max(E1) E from (
    SELECT B2,E1,RN-row_number() Over(Order by B1) groupByCol
    FROM CTE3
    ) t
    Group by groupByCol
    SELECT
    C2.B1,ISNULL(C4.E,C2.E1),C2.R1
    FROM CTE2 C2 LEFT JOIN CTE4 C4 ON C2.B1=C4.B
    If you have any question, feel free to let me know.
    Best regards,
    Eric Zhang

Maybe you are looking for