Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Help in Scripting

Hi All,

I have a table as shown below:

A         B

AA       test

AA       sample

AB       test

AC       sample

Now I have to load only those values of A in another table where value of B is both test and sample. The resulting table would look something like shown below:

A      B

AA    final

AB    test

AC    sample

Thanks,

Asma

4 Replies
ali_hijazi
Partner - Master II
Partner - Master II

since in the other table you'll have the same column names A, and B then auto concatenate will be applied by QlikView i.e. the two records will be added to original table

you can either do the following :

Table:

noConcatenate

load * resident original_table where B='test'

this way you'll have two tables but if you keep them you'll end up with synthetic keys

so you need to delete either of them

or you can do the following:

Table:

load A as Field1, B as Field2

resident original_table

where B='test'

I can walk on water when it freezes
prieper
Master II
Master II

Think that the EXISTS-formula might be of help

Aircode

A: LOAD A FROM TableA WHERE MATCH(B, 'test', 'sample');

B: LOAD * FROM TableB WHERE EXISTS(A);

DROP TABLE A;

Peter

Gysbert_Wassenaar

Maybe like this:

Temp:

LOAD * INLINE [

    A, B

    AA, test

    AA, sample

    AB, test

    AC, sample

];

Result:

NoConcatenate

LOAD A, 'Final' as B WHERE List = 'sample|test';

LOAD A, concat(B, '|', B) as List

RESIDENT Temp

GROUP BY A;

DROP TABLE Temp;


talk is cheap, supply exceeds demand
anbu1984
Master III
Master III

Load A Where B Like '*test*' And B Like '*sample*';
Load A,Concat(B,',') As B Group By A;
Load * Inline [
A,B
AA,test
AA,sample
AB,test
AC,sample ]
;