Finding the correct TIME

dabba23
Member Posts: 77
I have a process report that needs to consider the point of time it is run in order to set the correct filters.
I have written the following:
IF TIME >= 00:00:01 THEN
SETRANGE("Posting Date",CALCDATE('-1D',WORKDATE))
ELSE
SETRANGE("Posting Date",WORKDATE);
The point is that when the report is run after midnight, then it needs to filter on yesterdays posting date.
However, I have no idea how I find out if time is after midnight, as Time is of datatype Time and 00:00:01 is considered as an integer.
Any idea how I find after midnight?
Thanks
Ann
I have written the following:
IF TIME >= 00:00:01 THEN
SETRANGE("Posting Date",CALCDATE('-1D',WORKDATE))
ELSE
SETRANGE("Posting Date",WORKDATE);
The point is that when the report is run after midnight, then it needs to filter on yesterdays posting date.
However, I have no idea how I find out if time is after midnight, as Time is of datatype Time and 00:00:01 is considered as an integer.
Any idea how I find after midnight?
Thanks
Ann
0
Comments
-
Hi Ann,
use IF TIME > 000000T THEN0 -
Hardcoding ot time is
000000T = 0:00:00
101555T = 10:15:55
Dates
231206D = 23 12 20060 -
Thanks for the help
I have worked it out now0 -
Excuse my ignorance,
but when is time NOT after midnight?
//Pelle0 -
-
Hej Ann,
Whenever will the condition TIME > 000000T not be true ?
Actually you must test not test on, whether you pass midnight, but whether the NowTime is less than you ProcessStartTime, i.e.:// Start of process ProcessStartTime := TIME; WHILE StillProcessing DO BEGIN IF ProcessStartTime > TIME THEN use WORKDATE+1D ELSE use WORKDATE ... further processing END
When again, this code only helps you partly: You will need to reconsider, if your process is delayed and started after midnight - nor if your process does continue over several days...With Kind Regards
Thoms Hviid Thorn0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions