Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Load as X if field contains Y

Hello!

I would like to load data from the field [Category] that contains values that I want to break out into separate fields e.g.:

Name_[Type]_[Segment]

John_Blue_Big

Anna_Green_Small

George_Blue_Small

How should the script be written to load the values as 3 separate fields (Name, Type, Segment)?

Thank you!

3 Replies
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

You can use the function SubField() - look it up

simonc-cfn
Contributor III
Contributor III

Hi Jason,

For your requirement and example... consider the following...

I created an inline table with the following...

Table:

load * inline [

Field1

Name_Type_Segment

]

;

To break out each value into its own field, you can use the following...

Table2:

load

SubField(Field1,'_',1) as Name,

SubField(Field1,'_',2) as Type,

SubField(Field1,'_',-1) as Segment

resident Table

;

Hope this helps.

Simon

sujeetsingh
Master III
Master III

You can use subfield with different arguments.

subfield(Field,'_',1) as Column1

subfield(Field,'_',2) as Column2


subfield(Field,'_',3) as Column3