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

Subfield Function

Hi

I am debugging a script that was written by another Developer.

I came across a this function: subfield(Fieldname,';' ) as Fieldname1

I would like to know what the Developer was trying to achieve by an empty substring parameter.

Can you please advise?

1 Solution

Accepted Solutions
awhitfield
Partner - Champion
Partner - Champion

HI Tumela,

If index is omitted when subfield is used in a field expression in a load statement, the subfield function will cause the load statement to automatically generate one full record of input data for each substring that can be found in the string

e.g.

Loading the string 123;456;78910;1112 with Subfield(Record,.';') as Fields outputs separate records for each subfield

Fields

123

456

78910

1112

View solution in original post

4 Replies
PrashantSangle

Hi,

When you dont write index number then by default it is consider 1

In Help Menu you will get detail explanation with example.

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
awhitfield
Partner - Champion
Partner - Champion

HI Tumela,

If index is omitted when subfield is used in a field expression in a load statement, the subfield function will cause the load statement to automatically generate one full record of input data for each substring that can be found in the string

e.g.

Loading the string 123;456;78910;1112 with Subfield(Record,.';') as Fields outputs separate records for each subfield

Fields

123

456

78910

1112

morganaaron
Specialist
Specialist

When it's used in a load statement without an index, it creates a full record of input data for every substring it finds in that field - so it would create a record for every "substring" it finds in "fieldname" in your example.

Not applicable
Author

Thanks guy!...I learnt something new and it's quite useful I must say.