Options

Setrange on a time field

poppinspoppins Member Posts: 647
edited 2015-09-02 in NAV Three Tier
Hi everyone,
I am using a custom table, among fields are "Starting time" and "Ending time" (both of type time).
I want to add some checks to avoid overlapping between times.
I tried to use the same code as in standard NAV table 99000752 (Shop Calendar Working Days) for validating "Starting time" and "Ending time".
I put the following code in a function:
recXXX.SETRANGE("Starting Time",0T,"Ending Time" - 1);
recXXX.SETRANGE("Ending Time","Starting Time" + 1,235959T);
IF recXXX.FINDFIRST THEN
  ERROR('Conflict!!!');
and called the function in the OnValidate triggers of both fields.
The problem is that I keep getting the following error message:
The time is not valid
The debugger stops at the first instruction.
What shall I do?
Thanks in advance :mrgreen:

Comments

  • Options
    azatothazatoth Member Posts: 31
    Hi Poppins,

    you get this error because the "Ending Time" is zero (= 0T)

    Cheers!
Sign In or Register to comment.