Hi everyone,
I'm filtering this record to only query cases with completed date within nearest 5 days.
My query code is as below:
a!queryFilter( field: recordType!Record.completedDateTime, operator: ">", value: datetime( year(now()), month(now()), day(now()) - 5, 00, 00, 00, 00 ) )
The code worked well last week, but this morning it suddenly showed this error:
The Requested Record Type Is Not Available The default filters expression for record type failed to evaluate. Details: [Expression evaluation error at function a!queryFilter [line 4]: Date out of range: Invalid day]. (APNX-1-4205-018)
I've checked the DB and data for this column was the same structure as last week: datetime /* mariadb-5.3 */ . For example: 2022-08-01 04:14:49.
Any one has faced the same error code? Please give me some suggestion if possible...
Thank you!
Discussion posts and replies are publicly visible
It is because you are using day(now())-5 which is returning 31 date. According to expression it is taking 31st September which is invalid date. Instead of the expression which you used in value use the below one.
todatetime( today()-5)
The suggested expression works well. Thanks a lot. But I'm still confuse about 31st September you mentioned. Logically if we take current date -5, it should be 31st August which is a valid date right?
in your expression, month(now()) is returning september not august.
Oh I got it. Thank for your helps
YW