Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Creating a new table and dropping the initial

I am loading a table and deriving a new column during the load. Then I want to create a new table where the new column is 'Passed', and just load those records, have them in the new table and drop the first table. Is below correct? For some reason when I run this, I get all empty, and NewTable does not appear.

FirstTable:

Load [field1],

[field2],

[field3],

If (([field3]='Yes' and [field2]='No'), 'Passed', 'Not Passed') as NewField

FROM

MyFileLocation;


NewTable:

Load *

Resident FirstTable

Where NewField='Y';

Drop Table FirstTable;


11 Replies
ciaran_mcgowan
Partner - Creator III
Partner - Creator III

Almost


Where NewField='Passed';

krishnacbe
Partner - Specialist III
Partner - Specialist III

Hi,

Please find the corrected script. Hope that helps

FirstTable:

Load [field1],

[field2],

[field3],

If (([field3]='Yes' and [field2]='No'), 'Passed', 'Not Passed') as NewField

FROM

MyFileLocation;


NewTable:

Load *

Resident FirstTable

Where NewField='Passed';

Drop Table FirstTable;

Regards

Krishnapriya

Not applicable
Author

Sorry I copied incorrectly, I have it like that Where NewField='Yes'; but it does not work

ciaran_mcgowan
Partner - Creator III
Partner - Creator III

Yeah, I misread the script. Corrected now.

Not applicable
Author

I have it like this but again I get empty.. not sure what the problem is....

trdandamudi
Master II
Master II

Please share sample data, so that it will be easy for us to trouble shoot and get you an answer...

krishnacbe
Partner - Specialist III
Partner - Specialist III

Can you share the data in excel or share the qvw.

nagarjuna_kotha
Partner - Specialist II
Partner - Specialist II

hi

Try this.............

Error Is in this :If ([field3]='Yes' and [field2]='No'), 'Passed', 'Not Passed') as NewField

FirstTable:

Load [field1],

[field2],

[field3],

If ([field3]='Yes' and [field2]='No', 'Passed', 'Not Passed') as NewField

FROM

MyFileLocation;


NewTable:

Load *

Resident FirstTable

Where NewField='Y';

Drop Table FirstTable;

-Nagarjun

nagarjuna_kotha
Partner - Specialist II
Partner - Specialist II

you can use above script,

It will work.error in your script is there is one extra bracket after "   [field2]='No' " this.

check and revert back

_nagarjun