Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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?
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?
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;