Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I have the following table as compatibility matrix:
A1 | A2 | B1 | B2 | |
A1 | 0 | 1 | 0 | 1 |
A2 | 1 | 0 | 1 | 0 |
B1 | 0 | 1 | 0 | 1 |
B2 | 1 | 0 | 1 | 0 |
They are however elements of fields, as shown in the following tables:
A |
A1 |
A2 |
B |
B1 |
B2 |
I want to generate a table with all possible combination.
How is it possible?
Thanks in advance
Regards,
Amor
Try this,
tab1:
LOAD * INLINE [
F1, A1, A2, B1, B2
A1, 0, 0, 0, 1
A2, 0, 0, 1, 0
B1, 0, 1, 0, 0
B2, 1, 0, 0, 0
];
tab2:
CrossTable(Key, Value)
LOAD * Resident tab1;
tab3:
LOAD F1, Key As K1 Resident tab2
Where Value;
tab4:
LOAD F1 As A, K1 As B Resident tab3
Where F1 Like 'A*';
Concatenate(tab4)
LOAD F1 As B, K1 As A Resident tab3
Where F1 Like 'B*';
Drop Table tab1, tab2, tab3;
Hi,
maybe like this?:
tabTemp:
CrossTable (B,IsCompatible)
LOAD * FROM [https://community.qlik.com/t5/QlikView-App-Dev/Compatibility-matrix/m-p/1916516] (html, codepage is 1252, embedded labels, table is @4);
tabCompatibility:
LOAD F1 as A, B
Resident tabTemp
Where F1 like 'A*' and B like 'B*' and IsCompatible;
DROP Table tabTemp;
hope this helps
Marco
Are you looking for a script solution?
Yes, exactly!
maybe like this?
tabA:
LOAD A
FROM [https://community.qlik.com/t5/QlikView-App-Dev/Compatibility-matrix/m-p/1903972] (html, codepage is 1252, embedded labels, table is @2);
tabB:
LOAD B
FROM [https://community.qlik.com/t5/QlikView-App-Dev/Compatibility-matrix/m-p/1903972] (html, codepage is 1252, embedded labels, table is @3);
tabAB:
LOAD A as Value1
Resident tabA;
tabAB:
LOAD B as Value1
Resident tabB;
Join (tabAB)
LOAD Value1 as Value2
Resident tabAB;
Hi MarcoWendel,
thank you for your reply.
I should reformulate my question.
I habe this compatiblity matrix as Input from excel sheet:
A1 |
A2 |
B1 |
B2 |
|
A1 |
0 |
0 |
0 |
1 |
A2 |
0 |
0 |
1 |
0 |
B1 |
0 |
1 |
0 |
0 |
B2 |
1 |
0 |
0 |
0 |
A1 and A2 are elements from Field A
B1 and B2 are element form Field B
I want to generate the following table:
A |
B |
A1 |
B2 |
A2 |
B1 |
Could you help me with it?
Thanks in advance.
Amor
Try this,
tab1:
LOAD * INLINE [
F1, A1, A2, B1, B2
A1, 0, 0, 0, 1
A2, 0, 0, 1, 0
B1, 0, 1, 0, 0
B2, 1, 0, 0, 0
];
tab2:
CrossTable(Key, Value)
LOAD * Resident tab1;
tab3:
LOAD F1, Key As K1 Resident tab2
Where Value;
tab4:
LOAD F1 As A, K1 As B Resident tab3
Where F1 Like 'A*';
Concatenate(tab4)
LOAD F1 As B, K1 As A Resident tab3
Where F1 Like 'B*';
Drop Table tab1, tab2, tab3;
Hi,
maybe like this?:
tabTemp:
CrossTable (B,IsCompatible)
LOAD * FROM [https://community.qlik.com/t5/QlikView-App-Dev/Compatibility-matrix/m-p/1916516] (html, codepage is 1252, embedded labels, table is @4);
tabCompatibility:
LOAD F1 as A, B
Resident tabTemp
Where F1 like 'A*' and B like 'B*' and IsCompatible;
DROP Table tabTemp;
hope this helps
Marco
@MarcoWedel wrote: MyMerrill
Hi,
maybe like this?:
tabTemp: CrossTable (B,IsCompatible) LOAD * FROM [https://community.qlik.com/t5/QlikView-App-Dev/Compatibility-matrix/m-p/1916516] (html, codepage is 1252, embedded labels, table is @4); tabCompatibility: LOAD F1 as A, B Resident tabTemp Where F1 like 'A*' and B like 'B*' and IsCompatible; DROP Table tabTemp;
hope this helps
Marco
Amazing Script, Thank you for sharing!