sql connector: dynamic table and column

  • Klaus79
        4 years ago #18549

        Is it possible to select a column from a table which is only known at runtime.

        I tried that Statement:

        SELECT :attribute: as attribute FROM :table: where pernr = :pernr: and begda <= :date: and endda >= :date:

        but it runs into error.

        Mathieu Roll
            Has successfully completed the online course Introduction
            Has successfully completed the online course Intermediate (200)
            Has successfully completed the online course Advanced (300)
            Has successfully completed the online course Basics (100)
          4 years ago #18691
          Up
          0
          Down
          ::

          Hello Klaus,

          like you did will not work because the : param adds a type specification like ‘ for strings

          if you want to create a complete dynamic select you can fill the request parameter with a business object and create the select there.

          Klaus79
              4 years ago #23563
              Up
              0
              Down
              ::

              Hi Mathieu,

              several months ago when this topic was created I managed it without a dynamic sql but now I have chance to do it without one.

              I don’r really understand what you’re thinking of when you say “if you want to create a complete dynamic select you can fill the request parameter with a business object and create the select there”.

              I can’t imagine how to execute a complete sql statement imported as string or to take a dynamic sql where-clause as string and execute it.

               

              Could you provide me an example, please?

               

              Best regards

              Klaus

               

              Armin Winkler
                  Has successfully completed the online course Introduction
                  Has successfully completed the online course Intermediate (200)
                  Has successfully completed the online course Advanced (300)
                  Has successfully completed the online course Basics (100)
                3 years ago #24478
                Up
                0
                Down
                ::

                Hi Klaus,

                 

                what Mathieu meant was to build the whole SQL statement dynamically inside of a business object script and then pass it to the request parameter of your SQL connector call which must then be left blank in the respective creation dialog field. Basically this will give you the option to treat the SQL statement like an input parameter instead of the request getting taken from the SQL tab of the creation dialog.

                 

                Hope this clarifies Mathieu’s suggestion.

                 

                Regards,

                Armin

              Viewing 4 posts - 1 through 4 (of 4 total)

              You must be logged in to reply to this topic.