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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Create new field based on existing fields

Hi there,

I need to create a new field (Distributor) based on two existing fields ( Disti_Name , Disti_Corp_ID) with the condition shown in table below.

Is there any way to do this other than hard code?

Disti_Name

Disti_Corp_ID

Distributor

A_B

A B

AB

A_C

A C

AC

A_D

A D

AD

thanks!

2 Replies
felipedl
Partner - Specialist III
Partner - Specialist III

Hi Alice,

You could do it in two ways:

1: create during the table load statement a concatenation of the two fields, something like

x:

load * Inline

[

  Disti_Name,Disti_Corp_ID,Distributor

  A_B,A B,AB

  A_C,A C,AC

  A_D,A D,AD

];

NoConcatenate

Data:

Load

  Disti_Name,

  Disti_Corp_ID,

  Distributor,

Disti_Name & '|' & Disti_Corp_ID as Key_LoadStatement

Resident x;

drop table x;

Or create a table with the expression:

"=Disti_Name & Disti_Corp_ID"

Attached is a QVW with both options.

Regards,

Felipe. !

Not applicable
Author

Thanks Felip. Will test on this and update here.