Issue regarding Count between two dates and two times

dabba23dabba23 Member Posts: 77
Hey there,

I have to create a report that captures posted Inventory Picks that falls within a Service Level Agreement.

Service Level Agreement runs between 12:01:00 pm and 12:00:59 pm (i.e. 24 hours).
An Inventory Pick is created 01-08-06 at 15:00:00 pm and the Inventory Pick is posted 02-08-06 at 02:00:00 am.
The posted Inventory Pick falls within the Service Level Agreement, as in the above scenario the Service Level Agreement finishes 02-08-06 at 12.00:59 pm.

I have written following code, which obviously fails:

SETRANGE("Assignment Date",StartingDate,EndingDate);
ServiceLevelEndDate := "Assignment Date" + 1;

SETRANGE("Registering Date","Assignment Date",ServiceLevelEndDate);
SETRANGE("Registering Time","Assignment Time",CutOffTime); - fails on this line
COUNT;


Assignment Date and Time is when the Inventory Pick was created.
Registering Date and Time is when Inventory Pick was posted.
CutOffTime is defaulted to 12:01:00, i.e. when the service level agreement begins.

How do I find out if Registering Date and Time falls within Assignment Date/Time and end of Service Level Agreement?

Thanks :)

Comments

  • David_CoxDavid_Cox Member Posts: 509
    I am not sure and I havent used it but there is a datetime field in Navision.

    Create 2 variables and set the date times, then you would have to setrange Date, FromDate, ToDate
    REPEAT and calculate the records datetime and if RecDateTime is outside the range then skip.

    Or add and populate a datetime field then you can use standard filtering.

    I haven't used this so it is pure guesswork.

    I had a quick look and it's simple, you could just add a field and populate this on valiadate of you date and time fields, this you would be able to setrange on as well, between dates and times, the proplem with your code is if you setrange on time, it filters out any records before the start time regardless of the date, datetime type is like the date serial field in other languages.

    DateTime := CREATEDATETIME(Date, Time);
    Analyst Developer with over 17 years Navision, Contract Status - Busy
    Mobile: +44(0)7854 842801
    Email: david.cox@adeptris.com
    Twitter: https://twitter.com/Adeptris
    Website: http://www.adeptris.com
Sign In or Register to comment.