Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Exists not working properly

Hi Folks,

I got some wrong data when I am using exists function in the script.

My script is: (This is sample script)

ABC:

LOAD * INLINE [

    A, C

    1, asd

    1, tyu

    2, dfgf

];

Concatenate

LOAD * INLINE [

    A, C

    1, sdf

    1, fg

    1, ffg

    1, fr

    2, vg

    2, tte

    2, tgfg

    2, rew

    2, fgr

    3, rre

    3, abcd

    4, gtr

    4, jkl

    5, dfryujhb

    5, dfgh

] where not Exists (A);

I reload the data, I got only unique rows for A=3,4,5,

Below is my Table Box.

AC
1asd
1tyu
2dfgf
3rre
4gtr
5dfryujhb

Please find the atched application.

Why I am not getting full values in the second table.

Please help me this, I script is wrong.

Tags (1)
1 Solution

Accepted Solutions
swuehl
Not applicable

Exists not working properly

Your first table loads values 1 and 2 for field A.

Your where not exists clause then skips records from second table with values 1 and 2  in field A. Then it loads first record with value 3 in field A. Then looks at second record with value 3, but now field A already holds this value.

So QV will always use the most current content of the field, it is updated while loading.

3 Replies
swuehl
Not applicable

Exists not working properly

Try something like:

ABC:

LOAD *, A as AA INLINE [

    A, C

    1, asd

    1, tyu

    2, dfgf

];

Concatenate

LOAD * INLINE [

    A, C

    1, sdf

    1, fg

    1, ffg

    1, fr

    2, vg

    2, tte

    2, tgfg

    2, rew

    2, fgr

    3, rre

    3, abcd

    4, gtr

    4, jkl

    5, dfryujhb

    5, dfgh

] where not Exists (AA,A);

drop field AA;


Not applicable

Exists not working properly

Thanks for promt reply.

Your script work correctly. Why we need one more field AA. Is there any special Reason?

Thanks & Regards,

Siri

swuehl
Not applicable

Exists not working properly

Your first table loads values 1 and 2 for field A.

Your where not exists clause then skips records from second table with values 1 and 2  in field A. Then it loads first record with value 3 in field A. Then looks at second record with value 3, but now field A already holds this value.

So QV will always use the most current content of the field, it is updated while loading.