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: 
Anonymous
Not applicable

Adding multiple values to a field

Hi all,

I have two columns namely ZMERGE and SUBJECT GROUP. (table 1)

I have another table with ZMERGE values which refers to table 1 to give me subject group of the user: (table 2)

Table 1:

ZMERGESUBJECT GROUP
CHChemistry
LSLife Sciences
MDMedical Sciences
PSPsychology

Table 2:

NAMEZMERGE
JohnCH
PeterLS
BarryMD
FrankCH, LS, MD, PS

How do I, in the load script write in a value for SUBJECT GROUP call MULTIPLE_SUBJECTS so that for people like Frank (with multiple values in ZMERGE, they will have a proper value in SUBJECT GROUP?

(Also, the actual list is long so we can't just code in CH, LS, MD and PS).

Thank you in advance for all help!

Regards,

Wai Meng

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

This will create seperate rows for each ZMERGE that a NAME has in Table 2.

Table2:

LOAD NAME,

     trim(subfield ( ZMERGE , ',' )) as ZMERGE

FROM

[https://community.qlik.com/thread/276662]

(html, codepage is 1252, embedded labels, table is @2);

From that yo should be able visualize it how yo wish.

View solution in original post

9 Replies
Anonymous
Not applicable
Author

This will create seperate rows for each ZMERGE that a NAME has in Table 2.

Table2:

LOAD NAME,

     trim(subfield ( ZMERGE , ',' )) as ZMERGE

FROM

[https://community.qlik.com/thread/276662]

(html, codepage is 1252, embedded labels, table is @2);

From that yo should be able visualize it how yo wish.

devarasu07
Master II
Master II

Table1:

LOAD * INLINE [

    ZMERGE1, SUBJECT GROUP

    CH, Chemistry

    LS, Life Sciences

    MD, Medical Sciences

    PS, Psychology

];

Table2:

Load *,SubField(ZMERGE,',') as ZMERGE1;

LOAD * INLINE [

    NAME, ZMERGE

    John, CH

    Peter, LS

    Barry, MD

    Frank, "CH, LS, MD, PS"

];

drop Field ZMERGE from Table2;

Anonymous
Not applicable
Author

Hi Bill,

That worked a treat! Thank you!

I'm just wondering though for people with a variety of multiple ZMERGE values, if i still want to have it labelled as MULTIPLE_SUBJECTS in SUBJECT GROUP, how do we do it?

Anonymous
Not applicable
Author

Hi Devarasu,

Thank you for your help. However, I have a couple hundred of rows so I won't be able to list each row.

Regards,

Wai Meng

devarasu07
Master II
Master II

Hi,

Subfield function works for N of values. would be able to share mock app and expected result. will check and help you. thanks Deva

Anonymous
Not applicable
Author

Try using a Measure expression like this in your viz :

concat ( [SUBJECT GROUP]  , ', ' )

Having just NAME as you Dimension

sth_wch004
Contributor III
Contributor III

Capture.PNG !

sumanta12
Creator II
Creator II

TABLE1:

LOAD

ZMERGE,

    [SUBJECT GROUP]

FROM

[https://community.qlik.com/thread/276662]

(html, codepage is 1252, embedded labels, table is @1);

TABLE2:

LOAD

NAME,

TRIM(SubField(ZMERGE,',')) AS ZMERGE;

LOAD

NAME,

    ZMERGE

FROM

[https://community.qlik.com/thread/276662]

(html, codepage is 1252, embedded labels, table is @2);

Anonymous
Not applicable
Author

Thank you for this.

My initial thought was to have multiple ZMERGE values named as MULTIPLE_SUBJECTS.

In the end, subfield does the job pretty well (even better actually) to have the different subjects attributed to Frank.

Thanks alot for all your help and suggestions!