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: 
ranibosch
Creator
Creator

New field creation using existing fields

Hi,

I have a a table as follows:

No                         Transfer-from code                         Transfer-to code

TSHI047782          WRSS                                             WRSH

TSHI047783           WRWH                                            WRDI

etc.....

Basically I want to use the 'Transfer-from code" and then depending what the value in this field is, it should allocate it to a specific responsibility center.

So if the transfer-from code= WRSS,WRWH or WRDI

     Then the responsibility center should be = WR

if the transfer-from code = MTWH or MTDI

     Then the responsibility center should be = MT

The responsibility center is not available as a field in this table.

1 Solution

Accepted Solutions
Sergey_Shuklin
Specialist
Specialist

Hello!

Can you use Left() function for adding a new field?

Like

Load *,

Left(Transfer-from code,2) as responsibility_center

from data_table;


And if you have the responsibility_center field in another table it will be concatenated with new created.

View solution in original post

4 Replies
Sergey_Shuklin
Specialist
Specialist

Hello!

Can you use Left() function for adding a new field?

Like

Load *,

Left(Transfer-from code,2) as responsibility_center

from data_table;


And if you have the responsibility_center field in another table it will be concatenated with new created.

srishsum2017
Creator
Creator

please go through with

http://help.qlik.com/en-US/qlikview/12.1/Subsystems/Client/Content/Scripting/StringFunctions/Left.ht...

and other string functions

Sumit Kumar Srivastava
antoniotiman
Master III
Master III

May be like this

LOAD *,Pick(Match([Transfer-from code],'WRSS','WRWH','WRDI','MTWH','MTDI'),'WR','WR','WR','MT','MT') as [responsibility center] Inline [
No, Transfer-from code, Transfer-to code
TSHI047782, WRSS, WRSH
TSHI047783, WRWH, WRDI
TSHI047784, WRDI, WRDI
TSHI047785, MTWH, WRDI
TSHI047786, MTDI, WRDI
]
;

antoniotiman
Master III
Master III

or this

LOAD * Inline [
Transfer-from code,responsibility center
WRSS,WR
WRWH,WR
WRDI,WR
MTWH,MT
MTDI,MT]
;

LOAD * Inline [
No, Transfer-from code, Transfer-to code
TSHI047782, WRSS, WRSH
TSHI047783, WRWH, WRDI
TSHI047784, WRDI, WRDI
TSHI047785, MTWH, WRDI
TSHI047786, MTDI, WRDI
]
;