Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Join Records by coincidence in different fields

Guys,

I need to make a group of records. The condition to belong to this group is that they have to have the same value in at least one of three different fields. To give an example:

Custf1f2f3
a1-300
b1-100
c-10-
d210-
e310100
f430500

In this Case the Customers, a,b,c,d and e, have to be group together, cause f1 joins a with b, f2 joins c,d and e, and f3 joins b with e.

and Customer f hasn't any connection in any of the three fields.

Can anyone help me on this? I'm really stuck on this.

Thanks,

4 Replies
cwolf
Creator III
Creator III

I hope that helps you.

Not applicable
Author

Thanks Christian,

I'll try to understand the script structure and the functions you use (I've never used some of them), maybe I will ask you something more about this issue later.

sunny_talwar

Are you looking for a output like this?

Capture.PNG

If yes, then try this:

Table:

LOAD Cust,

    f1,

    f2,

    f3

FROM

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

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

Temp:

LOAD Concat(Cust, ',') as Group,

  f1

Resident Table

Group By f1;

Concatenate(Temp)

LOAD Concat(Cust, ',') as Group,

  f2

Resident Table

Group By f2;

Concatenate(Temp)

LOAD Concat(Cust, ',') as Group,

  f3

Resident Table

Group By f3;

Final:

LOAD Concat(DISTINCT Group, ',') as Group;

LOAD SubField(Group, ',') as Group

Resident Temp

Where SubStringCount(Group, ',') > 0;

DROP Table Temp;

Not applicable
Author

Thanks Sunny,

Actually what i'm looking for is an output like the following table, I add the id column to show how the groups have to be.

Thank you again!!

TABLE.jpg