3 Replies Latest reply: Oct 21, 2009 4:08 PM by rey-man RSS

    check if there is a record

    rey-man

      Hi,

       

      I've got this statement:

       


      TABLE:
      LOAD
      BMENG AS OrderIntake
      ,'$(vDatum)' AS Datum
      FROM [some.qvd] (qvd)
      WHERE [Vorige datum_VDATU] = '$(vDate)'


      If this date doens't exist I still want to add this date but with OrderIntake as 0.

      Is this possible? If Yes how?

       

      Thanks in advance.

      Rey-man

        • check if there is a record

          Hello Rey-man,

          Try this code along with your existing code:


          concatenate(TABLE)
          Load
          0 as OrderIntake,
          '$(vDatum)' as Datum
          from qvd
          where not exists([Vorige datum_VDATU],'$(vDate)');


           

          Hope this works for you.

           

          Thanks

          Amit

            • check if there is a record
              rey-man

              Hi Amit,

               

              thanks for the reply.

              Is there a way to look if it doesn't exist after some while criteria?

              For example:

              status must be '0000'

              and organisationnumber must be 1

               

              <pre>
              concatenate(TABLE)
              Load
              0 as OrderIntake,
              '$(vDatum)' as Datum
              from qvd
              where status = '0000'
              AND organisation = 1
              AND not exists([Vorige datum_VDATU],'$(vDate)');

               

               



               

              Rey-man

                • check if there is a record
                  rey-man

                  Hi,

                   

                  I've got the solution. Maybe it can ben better, but this works.

                  First I've created the table with the where statements in. Next I used that table to check if a date exists.

                  With your Concatenate statement it works fine now.

                  Rgds,

                  Rey-man