2 Replies Latest reply on Sep 12, 2015 6:49 AM by GuenterBorg

    SQL ..... searching in a ListField

    GuenterBorg

      Is it possible to search/validate in a Field with more ¶ separated values ?

       

      SetzeVar ( [

       

      a = "SELECT SUM(Menge)," & "'x'," &" Artikel," & "'€', SUM(Preis_Artikel_gesamt)

      FROM BON_Splitting WHERE sitz = ? AND Flag_boniert = ?GROUP BY Artikel"

      ] ;

      Austauschen(SQLAusführen ( a ; Char(9); ""; Sitznummer_Spli;1);".";",")

      )

       

      The Field "Sitznummer_Spli" can take one or more values.

       

      When "sitz" is in Sitznumer_Spli should display all real. Datas.

      e.g. when Sitznummer_Spli = 3 then all Data from 3

      when Sitznummer_Spli = 3¶5¶7   all Date from 3,5 and 7.

       

      thx

       

      Günter

        • 1. Re: SQL ..... searching in a ListField
          erolst

          GuenterBorg wrote:

          SetzeVar ( [

          a = "SELECT SUM(Menge)," & "'x'," &" Artikel," & "'€', SUM(Preis_Artikel_gesamt)

          FROM BON_Splitting WHERE sitz = ? AND Flag_boniert = ?GROUP BY Artikel"

          ] ;

          Austauschen(SQLAusführen ( a ; Char(9); ""; Sitznummer_Spli;1);".";",")

          )

          The Field "Sitznummer_Spli" can take one or more values.

           

          While you're using Let(), why not take full advantage of it?

           

          Anyway, you need the IN operator:

           

          Let ( [

            sql = "

              SELECT SUM ( Menge )," & "'x'," &

              " Artikel," & "'€', SUM ( Preis_Artikel_gesamt )

              FROM BON_Splitting

              WHERE

                sitz IN (" & Substitute ( Sitznummer_Spli ; ¶ ; "," ) & ") AND

                Flag_boniert = ?

              GROUP BY Artikel

              " ;

            result = ExecuteSQL ( sql ; Char(9) ; "" ; 1 )

            ] ;

            Substitute ( result ( "." ; "," )

          )

           

          GuenterBorg wrote:

          When "sitz" is in Sitznumer_Spli should display all real. Datas.

          “Datas” isn't an English word – thought you'd like to know …

          • 2. Re: SQL ..... searching in a ListField
            GuenterBorg

            Thank you very much erolst !