Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
ljdlumley
Contributor III
Contributor III

Using created fields elsewhere in load script

Hi, I've looked all over and can't find an answer.

In my load script I have a number of IF statements,

Table1:

Load Field1,

          Field2,

if (Field1>=30,1.5,if(Field1>=21,1,0)) as FlagField1

if (Field2>20 and Field2<90,0.5,0) as FlagField2

From abc.xlsx

These created fields work fine in my document but what I'm trying to do next is add all these Flag values (1-9) together to give an FlagOverall field within the load script.

Any ideas

John

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

The values Field1 and

Use preceding load like this:

Table1:

LOAD *,

    FlagField1 + FlagField2 As FlagOverall

;

Load Field1,

    Field2,

    if (Field1>=30,1.5,if(Field1>=21,1,0)) as FlagField1

    if (Field2>20 and Field2<90,0.5,0) as FlagField2

From abc.xlsx

Hope that helps

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

5 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

The values Field1 and

Use preceding load like this:

Table1:

LOAD *,

    FlagField1 + FlagField2 As FlagOverall

;

Load Field1,

    Field2,

    if (Field1>=30,1.5,if(Field1>=21,1,0)) as FlagField1

    if (Field2>20 and Field2<90,0.5,0) as FlagField2

From abc.xlsx

Hope that helps

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
ljdlumley
Contributor III
Contributor III
Author

Thanks Jonathan. It works perfectly, quite counter intuitive to put it at the top of the script!

John

hic
Former Employee
Former Employee

I would say that it is quite logical to put it on top, once you understand what it does...

See http://community.qlik.com/blogs/qlikviewdesignblog/2013/03/04/preceding-load

HIC

ljdlumley
Contributor III
Contributor III
Author

Thanks for the link, it makes sense now.

stevelord
Specialist
Specialist

Life saver!