SEARCH:

Database Automation Introduction

In the world of business applications, any framework or toolset that cannot handle calculated values is a non-starter. Almost every table will have associated derivations, from the simplest calculation of price * qty up to complex compound conditional expressions.

Andromeda in particular must provide all manner of automations, otherwise the 'zero-code' promise for business rules would rapidly fall apart.

Simple FETCH and EXTEND

All automations in Andromeda consist in one way or another of specifying a formula for the columns in tables. Here is a very simple example of an ordering system, where the price is obtained from the products file, a setup charge is added to it, and the result is extend out:

   foreign_key products:
      uisearch: "Y"
      
   column price:
      automation_id: FETCH
      auto_formula: products.price
   column qty:
   column price_ext:
      suffix: _ext
      description: Extended
      chain calc:
         test 00:
            return: @price * @qty
   column price_setup:
      suffix: _setup
      description: Setup Charge
   column price_final:
      suffix: _final
      chain calc:
         test 00:
            return: @price_ext + @price_setup

...and this results in a UI screen in which the calculations are performed automatically:

Summary Automations

While a FETCH operation pulls a value from a parent table to a child, you might also SUM the rows of a child table up to the parent. Here is the quotes header table from the example above, showing the total of detail lines plus further calculations:

   column price:
      suffix: _lines
      description: Detail Total
      automation_id: SUM
      auto_formula: quotelines.price_final
   column pct_manual:
      suffix: _manual
      description: Discount Pct;
   column price_disc:
      suffix: _disc
      description: Discount Amount
      chain calc:
         test 00:
            compare: @pct_manual = 0
            return: @price_lines
         test 01:
            return: @price_lines * @pct_manual
   column price_final:
      suffix: _final
      description: Final Price
      chain calc:
         test 00:
            return: @price_lines - @price_disc

...and the screen appears as:

Conclusion

There are a considerable number of other automations possible with Andromeda. Taken together, their purpose is to allow any type of derivation within a normalized database.

Andromeda's approach to complexity is to build up complicated rules by composition, so that one calculated value can be used in the result of another, which is then used in the result of another, and so forth. More information on this is provided in the Tutorials.