Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Alternative to doing multiple table loads to create fields?

I am interested in figuring out a way to create fields out of my initial data load and then use those created fields to create new fields without needing to do multiple table loads. Below is an example of what I'm talking about:

Tmp:

Load *,

if(field1 = 1, 'value1',

if(field1 = 2, 'value2',

if(field3 = 3, 'value3'))) as created_field

Resident Master

Drop Table Master;

Rename table tmp to Master;

Tmp:

Load *,

if(created_field = 'value1', 'x'

if(created_field = 'value2', 'y'

if(created_field = 'value3', 'z'))) as created_field_2

Resident Master

Drop Table Master;

Rename table tmp to Master;

I have done this so many times that my qlikview script is very slow to load. Is there an alternative?

2 Replies
MVP
MVP

Re: Alternative to doing multiple table loads to create fields?

Matthew,

seems I don't understand what you are trying to achieve. What's the benefit of loading the tables in that way instead of

Tmp:

Load *,

if(field1 = 1, 'x',

if(field1 = 2, 'y',

if(field3 = 3, 'z'))) as created_field_2

Resident Master

Drop Table Master;

Rename table tmp to Master;



Or even doing the same in a preceding LOAD to your master table LOAD?

Re: Alternative to doing multiple table loads to create fields?

Use preceding loads:

Master:

Load *,

if(created_field = 'value1', 'x'

if(created_field = 'value2', 'y'

if(created_field = 'value3', 'z'))) as created_field_2

;

Load *,

if(field1 = 1, 'value1',

if(field1 = 2, 'value2',

if(field3 = 3, 'value3'))) as created_field

;

Load * From MySource;


talk is cheap, supply exceeds demand
Community Browser