Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

wanyunyang
Contributor

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
MVP
MVP

Re: Declare

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.

3 Replies
MVP
MVP

Re: Declare

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
Contributor

Re: Declare

Thank you very much!

MVP
MVP

Re: Declare

You're welcome