Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Script Assistance on adding a field

In my script, I redefined a field as follows in order to differentiate this date field from others in the dashboard :

Date as 'CC_Date'    

Now I want to create a week field based on the 'CC_Date'. However, when I use:

Week(CC_Date) as Week,

The script is coming back as invalid because of my field for week.

1 Solution

Accepted Solutions
MVP
MVP

Re: Script Assistance on adding a field

You can't reference your new field CC_Date in the same LOAD statement where you are creating it.

You can use the new field in a preceding LOAD

Preceding Load

or reference the original field name:

LOAD *,

     Week(CC_Date) as WeekOnNewField;

LOAD

     Date as 'CC_Date' ,

     Week(Date) as WeekOnOriginalField,

     ...

FROM ...;

Your Date field should show a numeric representation in both cases, to allow the Week() function to work.

Get the Dates Right

1 Reply
MVP
MVP

Re: Script Assistance on adding a field

You can't reference your new field CC_Date in the same LOAD statement where you are creating it.

You can use the new field in a preceding LOAD

Preceding Load

or reference the original field name:

LOAD *,

     Week(CC_Date) as WeekOnNewField;

LOAD

     Date as 'CC_Date' ,

     Week(Date) as WeekOnOriginalField,

     ...

FROM ...;

Your Date field should show a numeric representation in both cases, to allow the Week() function to work.

Get the Dates Right

Community Browser