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

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

Table_1:

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

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

FROM ...

8 Replies
Valued Contributor

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

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

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:

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?

MVP

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

Table_1:

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

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

FROM ...

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];

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!

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;

*,

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

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

FROM ...

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

MVP

## 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 ...