Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
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.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

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.

View solution in original post

3 Replies
swuehl
MVP
MVP

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
Author

Thanks for promt reply.

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

Thanks & Regards,

Siri

swuehl
MVP
MVP

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.