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: 
omarlq20
Contributor II
Contributor II

interseccion / intersection

Necesito que me apoyen en el siguiente caso /

I need your support in the following case:

Tabla A

Cod
Nom
1AA
2AB
3AC
4AD
5BA
6BB
7BC
8BD

Tabla B

Cod
Dat
2ACV
3BCT
5DGT
6ADD

Lo que quiero es poder hacer los siguientes filtros

Todo = { 1,2,3,4,5,6,7,8 }

Solo B = { 2,3,5,6 }

Todo lo que esta en A y no en B = { 1,4,7,8 }

What I want is to do the following filters
All = { 1,2,3,4,5,6,7,8 }
Only B = { 2,3,5,6 }
All that is in A and not B = { 1,4,7,8 }


1 Solution

Accepted Solutions
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

Check with this

TableA:

Load * Inline

[Cod,Nom

1,AA

2,AB

3,AC

4,AD

5,BA

6,BB

7,BC

8,BD];

TableB:

LOAD * Inline

[Cod,Dat

2,ACV

3,BCT

5,DGT

6,ADD

];

Temp:

Load Chr(39) & Concat(Distinct Cod,Chr(39) & ',' & Chr(39)) & Chr(39) as CodA Resident TableA;

Let vCodA = FieldValue('CodA',1);

Drop Table Temp;

Temp:

Load Chr(39) & Concat(Distinct Cod,Chr(39) & ',' & Chr(39)) & Chr(39) as CodB Resident TableB;

Let vCodB = FieldValue('CodB',1);

DROP Table Temp;

FilterTable:

LOAD 'Table A' as Tablename,Cod Resident TableA Where Match(Cod,$(vCodA));

LOAD 'Only Table A' as Tablename,Cod Resident TableA Where not Match(Cod,$(vCodB));

LOAD 'Both Table A and Table B' as Tablename,Cod Resident TableA Where Match(Cod,$(vCodB)) and Match(Cod,$(vCodA));

Celambarasan

View solution in original post

5 Replies
perumal_41
Partner - Specialist II
Partner - Specialist II

Hi,

use this script .helpful for u

tableb:

Load * inline [

Cod, Dat

   

2,    ACV

3,    BCT

5,    DGT

6,    ADD

];

Load *  where Not exists (Cod);

TableA:

Load * Inline [

Cod, Nom

   

1,    AA

2 , AB

3,    AC

4,    AD

5    ,BA

6,    BB

7    ,BC

8    ,BD

];

tabA:

Load Rowno(),* Resident  TableA;

Drop table TableA,tableb

Regards

Perumal A

omarlq20
Contributor II
Contributor II
Author

I have to get the information in Table A and Table B, and then to apply the filters, I need cod and name fields

When you select should show all

CodNomDat
1AA-
2ABACV
3ACBCT
4AD-
5BADGT
6BBADD
7BC-
8BD-

when I select the intersection of Table A and Table B

Cod NomDat
2ABACV
3ACBCT
5BADGT
6BBADD

when I select the data of Table A that are not in the Table B

CodNomDat
1AA-
4AD-
7BA-
8BD-



CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Little more brief please. how you need to filter?Are you going to use filter(List box) with text as Only Table A,Only Table B,Table A-TableB,All?

Celambarasan

omarlq20
Contributor II
Contributor II
Author

precisely that type of filter is the need, the other I put as an example so you can better understand

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

Check with this

TableA:

Load * Inline

[Cod,Nom

1,AA

2,AB

3,AC

4,AD

5,BA

6,BB

7,BC

8,BD];

TableB:

LOAD * Inline

[Cod,Dat

2,ACV

3,BCT

5,DGT

6,ADD

];

Temp:

Load Chr(39) & Concat(Distinct Cod,Chr(39) & ',' & Chr(39)) & Chr(39) as CodA Resident TableA;

Let vCodA = FieldValue('CodA',1);

Drop Table Temp;

Temp:

Load Chr(39) & Concat(Distinct Cod,Chr(39) & ',' & Chr(39)) & Chr(39) as CodB Resident TableB;

Let vCodB = FieldValue('CodB',1);

DROP Table Temp;

FilterTable:

LOAD 'Table A' as Tablename,Cod Resident TableA Where Match(Cod,$(vCodA));

LOAD 'Only Table A' as Tablename,Cod Resident TableA Where not Match(Cod,$(vCodB));

LOAD 'Both Table A and Table B' as Tablename,Cod Resident TableA Where Match(Cod,$(vCodB)) and Match(Cod,$(vCodA));

Celambarasan