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

Subfield Function Issue

Hi Team,

I am trying to create a new field from the existing field in the datamodel using Subfield function.

The field is separated by ; and there is no limit in adding the contents inside.

Hence I have used Subfield(Field_name,';) as Newfield and this gives correct results.

However when I try to create the statistics box which should show the number of records in my database/user selected it is giving more numbers than what is available.Then I realized that the numbers are from the above formula which adds more rows.

Could you please suggest me if we have a easy way.

Thanks & Regards

Jeba

1 Solution

Accepted Solutions
MarcoWedel

table1:

LOAD allyourotherfields,

          Field_name,

          Autonumber(Field_name) as %ID

FROM source;

tableSubfields:

LOAD %ID,

          Subfield(Field_name,';') as Newfield

Resident table1;

View solution in original post

8 Replies
MK_QSL
MVP
MVP

TRY BELOW ONE

Subfield(Field_name,';',1) as Newfield

Anonymous
Not applicable
Author

Hi Manish,

That separates only one field like below

Jeba;Malai - It displays as Jeba and Malai

Jeba;Malai;Dass - This is not working based on the above logic

Regards

Jeba

Anonymous
Not applicable
Author

Hi,

use an unique id or use distinct key word in your expression  to show the number of records in your database.

SunilChauhan
Champion
Champion

Subfield(Field_name,';',n) as Newfield  n=1,2,3,4....



abc;cde;efg;ghi;ijk


subfield('abc;cde;efg;ghi;ijk',';',1)  ----------------------->abc

subfield('abc;cde;efg;ghi;ijk',';',2)  ----------------------->cde

subfield('abc;cde;efg;ghi;ijk',';',3)  ----------------------->efg

subfield('abc;cde;efg;ghi;ijk',';',4)  ----------------------->ghi


subfield('abc;cde;efg;ghi;ijk',';',5)  ----------------------->ghi


or share sample

Sunil Chauhan
SunilChauhan
Champion
Champion



for  Jeba;Malai;Dass


subfield(Fieldname,';',1)   Results in Jeba

subfield(Fieldname,';',2)   Results in Malai

subfield(Fieldname,';',3)   Results in Dass


hope this helps

Sunil Chauhan
MarcoWedel

table1:

LOAD allyourotherfields,

          Field_name,

          Autonumber(Field_name) as %ID

FROM source;

tableSubfields:

LOAD %ID,

          Subfield(Field_name,';') as Newfield

Resident table1;

its_anandrjs

Hi,

Check this

Table:

LOAD

String,

SubField(String,';') as SubNewString;

Load * inline [

String

Jeba;Malai;Dass ];

op55.png

Provide sample data.

Regards

Anand

Anonymous
Not applicable
Author

Hi Marco,

This works perfect and thanks a lot.

Regards

Jeba