Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am tryining to follow the examples from Qlik Sense Cookbook - > how to use subroutines in Qlik Sense.
I am trying to get Timestamp from the variable that I save earlier:
To simplify I try to run following code:
LET vQVDStartTime = timestamp(now(),'DD MMM YY hh:mm:ss');
TablesLoaded:
LOAD
'test' AS [STDQVD Name],
Timestamp($(vQVDStartTime),'DD MMM YY hh:mm') AS [STDQVD Start Time]
AUTOGENERATE (1);
The eror message:
I am using german version of Qlik Sense November 2018 ( I got the same error with September 2018).
I tried different time formats but nothing seems to work.
What is wrong with this code.
I appreciate your help.
Your variable contained a dual-value created by the timestamp-function but by calling the variable only the string-representation will be taken and without wrapping the variable with single-quotes it leads to an invalid value. Therefore use:
...
Timestamp('$(vQVDStartTime)','DD MMM YY hh:mm') AS [STDQVD Start Time]
...
Even better would be if leave the formatting by creating the variable and just using:
LET vQVDStartTime = now();
- Marcus
Would leaving it to be just Now()... would it still not format it as a timestamp? May be it doesn't but, may be explicitly storing it as a number might help as well
LET vQVDStartTime = Num(Now());
Your variable contained a dual-value created by the timestamp-function but by calling the variable only the string-representation will be taken and without wrapping the variable with single-quotes it leads to an invalid value. Therefore use:
...
Timestamp('$(vQVDStartTime)','DD MMM YY hh:mm') AS [STDQVD Start Time]
...
Even better would be if leave the formatting by creating the variable and just using:
LET vQVDStartTime = now();
- Marcus
Thank you. The single quotes helped.
Would leaving it to be just Now()... would it still not format it as a timestamp? May be it doesn't but, may be explicitly storing it as a number might help as well
LET vQVDStartTime = Num(Now());
Hi Sunny,
you are right - now(), today() and so on will be formatted like the settings in the default-variables and therefore the num() will be needed.
- Marcus