Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
Is it possible to set the default format for a date/number in the script instead of the document properties.
What I am trying to do is calculate the start of the month of a particular date and have that month start formatted as MMM-YY while still remaining as a date datatype (allows other formatting and implicit sorting).
I want to include this in a master calendar procedure so I would prefer to be able to script the formatting instead of manually amending it.
Thoughts?
There is a simple trick to do that
First you create a dummy table to format you field
Temp:
LOAD
date(Today(),'MMM/YYYY') AS _month
AutoGenerate 1;
then you load you real data
yourrealtable:
LOAD
rand() as field1,
rand() as field2,
monthstart(today() - RecNo()) as _month
AutoGenerate 100;
Then you can drop your dummy
Drop Table Temp;
QlikView seems to respect the format of first data loaded for a field
Hello David,
You can set the default format in script by:
SET DateFormat='MMM-YY';
Is this what are you looking for?
That is the universal option that applies to all dates in your model. I am looking for an option for individual fields.
There is a simple trick to do that
First you create a dummy table to format you field
Temp:
LOAD
date(Today(),'MMM/YYYY') AS _month
AutoGenerate 1;
then you load you real data
yourrealtable:
LOAD
rand() as field1,
rand() as field2,
monthstart(today() - RecNo()) as _month
AutoGenerate 100;
Then you can drop your dummy
Drop Table Temp;
QlikView seems to respect the format of first data loaded for a field