3 Replies Latest reply: Apr 18, 2012 5:21 PM by Stefan Wühl RSS

    Exists not working properly

    Srikanth P

      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.

        • Exists not working properly
          Stefan Wühl

          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;

           


            • Exists not working properly
              Srikanth P

              Thanks for promt reply.

               

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

               

               

              Thanks & Regards,

              Siri

                • Exists not working properly
                  Stefan Wühl

                  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.