E2E Bridge E2E Commerce

Derive an action at runtime

E2E Forum Modeling & Development Derive an action at runtime

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #357

    Recently I had the problem to apply an calculation where the formula depends on some conditions. But as you probably know, it is not possible to build an action script dynamically at runtime.
    Thus, I found an approach using SQL, because it is possible to create a SQL statement at runtime. I have implemented this as follows:
    1. Create a temporary SQLite table in memory:
    CREATE TABLE “ATPcalculator” (“MATNR” text,
    “ATP” float,
    “UNCQTY_CURMTH” float,
    “UNCQTY_PREVMTH” float,
    “UNCQTY_NEXTMTH” float)
    2. Insert data into table:
    INSERT INTO “ATPcalculator” (MATNR,
    3. Build SQL statement in an action script:
    set sql = concat(“select “, formula, ” as atp from ATPcalculator where MATNR ='”, matnr, “” );
    The value in formula could be an expression like “ATP – (UNCQTY_CURMTH + UNCQTY_PREVMTH)”
    4. Perform SQL statement to get the calculated ATP value for a material.
    5. Drop temporary table

    This solution works fine, but i’m wondering whether there is maybe not a less complicated approach.
    Any suggestions ? Maybe with Java-Script ? How could look a different solution?

    Marcel R.

    This is exactly one of the main reasons we added JavaScript. Just build the JavaScript and give it as input to the JavaScript Adapter. Documentation is not yet done but will follow soon.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.