Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I want to calculate last 4 hours in script, but it's not working. I have the following expressions:
MinMaxDate:
LOAD
Max(TimeStamp(STAMP)) as MaxDate
Resident Table;
LET vMaxDate = peek ('MaxDate', 0, 'MinMaxDate');
FilterCalendar:
LOAD distinct
STAMP
Resident Table
Where $(vMaxDate) - timestamp(STAMP) <4/24;
Any ideas?
It all depends on how the data looks...
But the most probable cause, is that vMaxDate is formatted as a timestamp, and then your dollar expansion will cause problems:
... Where $(vMaxDate) - timestamp(STAMP) <4/24;
probably expands to something like
... Where 2022-06-20 13:14:15 - timestamp(STAMP) <4/24;
which will give an error.
Try single quotes:
... Where '$(vMaxDate)' - STAMP <4/24;
It all depends on how the data looks...
But the most probable cause, is that vMaxDate is formatted as a timestamp, and then your dollar expansion will cause problems:
... Where $(vMaxDate) - timestamp(STAMP) <4/24;
probably expands to something like
... Where 2022-06-20 13:14:15 - timestamp(STAMP) <4/24;
which will give an error.
Try single quotes:
... Where '$(vMaxDate)' - STAMP <4/24;
It works! Thank you