How to add new table to database with separate database request

  • Samuel Wölfl
        1 year ago #38317

        I have a table that is filled with data from an API call. The data is different materials with material numbers, etc.
        And now I want to add a new column to the table which get’s dynamically filled with the stock of this material. This is not transmitted in the first API call but needs to be called separate by providing the material number. So I want a dynamic API call which adds it’s results in a new column to the base table – of course in the right row to the right material.

        But I just can’t get this to work, although I tried so much :/

        Jennifer Häfner
            Has successfully completed the online course Intermediate (200)
            Has successfully completed the online course Advanced (300)
            Has successfully completed the online course Basics (100)
            Has successfully completed the online course Advanced (310)
            Has successfully completed the online course Advanced (320)
            Has successfully completed the Intermediate Certification
            Has successfully completed the Advanced Certification
          1 year ago #38470
          Up
          1
          Down
          ::

          Addition: for OData, you can use the query option ‘expand’ in the Connector call to add the stock information to the material data (however, check your API if this is supported).

          In this article, we describe how to use query options in an OData Connector (step 3): https://community.simplifier.io/knowledge/how-to-use-query-options-in-odatav2-connector/

          Jennifer Häfner
              Has successfully completed the online course Intermediate (200)
              Has successfully completed the online course Advanced (300)
              Has successfully completed the online course Basics (100)
              Has successfully completed the online course Advanced (310)
              Has successfully completed the online course Advanced (320)
              Has successfully completed the Intermediate Certification
              Has successfully completed the Advanced Certification
            1 year ago #38466
            Up
            0
            Down
            ::

            Hi Samuel,

            I recommend to merge the data in a Server-Side Business Object (SBO) function before loading it into the table. So, in the function, fetch the material data using the Connector call that you already use for the table. For each material, also fetch the stock data with the other Connector call. Add the stock data to the material object. Depending on your backend, this can be done in one Connector call, for example, by joining two tables in MySQL.

            After having merged the data, the SBO function returns an array of material objects with an additional field (the stock data) and you can build your table just as you did before.

            Does this help you?

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

          You must be logged in to reply to this topic.