Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator
Creator

Qlikview - SQL and Script Editing

Dear all,

I have managed to load data from our SQL server into Qlikview by:

ODBC CONNECT32................................

SQL

SELECT a,b,c FROM TABLE1

;

Then later on I would like to create a few new fields using:

LOAD *;

IF(MATCH(a,'Apples'),'FRUIT','VEGETABLE') as GROCERY_MARKER;

This last line of code does not give me the newly created GROCERY_MARKER among my field list.

So two questions:

1.Should my SQL be under a LOAD command (I know Qlikview does it by default) and the result to be defined by a Table name?

ie.

ODBC CONNECT32................................

GROCERY_Tbl:

LOAD *;

SQL

SELECT a,b,c FROM TABLE1

;

2. How can I get this new field to appear on my field list?  I believe it might be related to the first question, as I might need to define my table to refer to it on question 2.

Thanks for your help and patience,

Aksel

1 Solution

Accepted Solutions
Highlighted
Specialist III
Specialist III

hello

you should code it in this way

odbc ...

grocery_tbl:

load *,

IF(MATCH(a,'Apples'),'FRUIT','VEGETABLE') as GROCERY_MARKER;

sql

select ....

;

and your new field will appear with the others

View solution in original post

4 Replies
Highlighted
Specialist III
Specialist III

hello

you should code it in this way

odbc ...

grocery_tbl:

load *,

IF(MATCH(a,'Apples'),'FRUIT','VEGETABLE') as GROCERY_MARKER;

sql

select ....

;

and your new field will appear with the others

View solution in original post

Highlighted
Creator
Creator

Does this mean that every time I add a new field after my load line, I need to rerun the whole SQL?  or can I just run that bit on its own?

Thanks for quick come back.

Highlighted
Specialist III
Specialist III

you can also run your sql once and store the result in a qvd file

then load your data from this qvd and add additional fields

Highlighted
Creator
Creator

Thank you.