Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

How to reference a value in line y of the script that was defined in line x of the script?

In the code below, I define [Days_Open] on the first line and want to reference it in the second line. My reload says the [Days_Open] field cannot be found.

Anyone know what's going on? How can I fix this?

Interval(Today()-[Entry Date],'d') as [Days_Open],

If([Days_Open]<=30,'0-30 Days','>30 Days') as [Days_Group]

1 Solution

Accepted Solutions

Re: How to reference a value in line y of the script that was defined in line x of the script?

Table_1:

LOAD *,

           If([Days_Open]<=30,'0-30 Days','>30 Days') as [Days_Group];

LOAD ... //many fields

          Interval(Today()-[Entry Date],'d') as [Days_Open]

FROM ...

8 Replies
johncaqc
Valued Contributor

Re: How to reference a value in line y of the script that was defined in line x of the script?

Use a preceeding load statement.

Load

     If([Days_Open]<=30,'0-30 Days','>30 Days') as [Days_Group]; // Note the semi-colon

Load

     Interval(Today()-[Entry Date],'d') as [Days_Open],

     ...

HTH,

John

Not applicable

Re: How to reference a value in line y of the script that was defined in line x of the script?

John,

I just tried that as:

LOAD If([Days_Open]<=30,'0-30 Days','>30 Days') as [Days_Group];

Table_1:

LOAD ... //many fields

          Interval(Today()-[Entry Date],'d') as [Days_Open]

FROM ...

While I didn't get an error, Table_1 came up empty.

Did I organize the script incorrectly? Any other issues I'm not seeing?

Re: How to reference a value in line y of the script that was defined in line x of the script?

Table_1:

LOAD *,

           If([Days_Open]<=30,'0-30 Days','>30 Days') as [Days_Group];

LOAD ... //many fields

          Interval(Today()-[Entry Date],'d') as [Days_Open]

FROM ...

johncaqc
Valued Contributor

Re: How to reference a value in line y of the script that was defined in line x of the script?

Try rearranging the script a bit...


Table_1;

LOAD If([Days_Open]<=30,'0-30 Days','>30 Days') as [Days_Group];

LOAD ... //many fields

          Interval(Today()-[Entry Date],'d') as [Days_Open]

FROM ...



Not applicable

Re: How to reference a value in line y of the script that was defined in line x of the script?

Worked like a charm. Thank you Marco and John!

johncaqc
Valued Contributor

Re: How to reference a value in line y of the script that was defined in line x of the script?

Oops, one more thing...(forgot the *)

Table_1;

LOAD

     *,

     If([Days_Open]<=30,'0-30 Days','>30 Days') as [Days_Group];

LOAD ... //many fields

          Interval(Today()-[Entry Date],'d') as [Days_Open]

FROM ...


johncaqc
Valued Contributor

Re: How to reference a value in line y of the script that was defined in line x of the script?

thanks marco...again you step on my posts

Re: How to reference a value in line y of the script that was defined in line x of the script?

just wanted to help ...

Naveed, please mark John's final answer as correct instead of mine.

thanks

regards

Marco

Community Browser