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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
aetingu12
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
olivierrobin
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
olivierrobin
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

aetingu12
Creator
Creator
Author

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.

olivierrobin
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

aetingu12
Creator
Creator
Author

Thank you.