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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Derive additional column on existing table during Load

Hi!

Is there a way I can derive an additional field on existing table during the LOAD?

Sample Output:

   

IDStatusFinal Status
AbcpassPassed
Defpass (with special cases)Passed
GhifailFailed

Final Status column will be my additional/derive field based on the initial Status field on my existing table.

Appreciate your help.

-Bea

Labels (1)
1 Solution

Accepted Solutions
stigchel
Partner - Master
Partner - Master

You can do a load from an existing table using resident, if you want add (join) the column to the existing table use a join load. Something like:

Join (SourceData) LOAD

ID,

If(left(Status,4)='pass','Passed',If(left(Status,4)='fail','Failed')) as [Final Status]

Resident SourceData;

View solution in original post

3 Replies
stigchel
Partner - Master
Partner - Master

You can do a load from an existing table using resident, if you want add (join) the column to the existing table use a join load. Something like:

Join (SourceData) LOAD

ID,

If(left(Status,4)='pass','Passed',If(left(Status,4)='fail','Failed')) as [Final Status]

Resident SourceData;

Ralf-Narfeldt
Employee
Employee

Add a preceding load that adds the Final Status:

Load *, If(left(Status,4) = 'fail', 'Failed', 'Passed') As [Final Status];

Load * inline [

ID,Status

Abc,pass

Def,pass (with special cases)

Ghi,fail];

This is based on your input data, if you have more possible values, you may need to adjust the If condition.

Not applicable
Author

Works perfectly! Thanks!