Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
wanyunyang
Creator III
Creator III

Declare

I'm trying to understand what does this example in Qliksense Help means:

calendar.PNG

My questions are:

1. Is it creating a table named Calendar from a source table?

2. Is TAGGED followed by the value type of the field?

3. What is the "$1" in the parentheses?

Any advice helps! Thanks in advance!

1 Solution

Accepted Solutions
petter
Partner - Champion III
Partner - Champion III

1) The DECLARE means that a table named Calender will be created if there are any fields with a tag '$date' in any table.

2) No - a field does not have a type. A field can have any combination of types or no type at all if it is empy or contains just null values. So a field can have zero or more tags indicating that there exists one or more values of the type indicated by the tag.

3) $1 is a placeholder of the actual fieldname that will be replaced before the expression is evaluated on the the field. In the declaration we don't know how many fields that will be encountered that has the tag $date in this case - and we don't know the names of them. So $1 is just indicating the position of the fieldname in the expression that calculates the various derived fields like Year, Month, Date, Week, WeekDay, DayNumberOfYear.

It is up to Qlik Sense during load script processing to enforce the declaration and create the derived fields in the table Calendar if and only if it finds any fields with the tag $date.

View solution in original post

3 Replies
petter
Partner - Champion III
Partner - Champion III

1) The DECLARE means that a table named Calender will be created if there are any fields with a tag '$date' in any table.

2) No - a field does not have a type. A field can have any combination of types or no type at all if it is empy or contains just null values. So a field can have zero or more tags indicating that there exists one or more values of the type indicated by the tag.

3) $1 is a placeholder of the actual fieldname that will be replaced before the expression is evaluated on the the field. In the declaration we don't know how many fields that will be encountered that has the tag $date in this case - and we don't know the names of them. So $1 is just indicating the position of the fieldname in the expression that calculates the various derived fields like Year, Month, Date, Week, WeekDay, DayNumberOfYear.

It is up to Qlik Sense during load script processing to enforce the declaration and create the derived fields in the table Calendar if and only if it finds any fields with the tag $date.

wanyunyang
Creator III
Creator III
Author

Thank you very much!

petter
Partner - Champion III
Partner - Champion III

You're welcome