Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
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
Honored Contributor

Re: Help in Scripting

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'

prieper
Honored Contributor II

Re: Help in Scripting

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

Re: Help in Scripting

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
Honored Contributor III

Re: Help in Scripting

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 ]
;

Community Browser