Define Formula Expressions

This is where you build business formulas based on your business needs. Using pre-defined arguments, you can structure a formula into steps and test it. The formula expressions support different types of results (simple or collection).

To define a formula expression:

  1. Open the Main Menu in FintechOS Studio and select Automation Blocks > Business Formulas > Formula
  2. Click Insert at the top right corner of the page.
  3. Enter a Name for the formula.
  4. Select the Start Date when you wish to activate the formula (see Formula Versioning). By default, it uses the current date and time.
  5. In the Formula Input field, select the set of arguments that will be processed by the formula (see Define Formula Inputs for details).
    NOTE  
    Once you Activate a Formula, you can no longer change the formula input.
  6. The End Date and Version fields are populated automatically based on the formula's versioning. For details, see Formula Versioning.
  7. Tick the Is Audited checkbox if you wish to track the formula usage. This will save auditing details in the EbsMetadata_FTOS_CALC_FormulaAudit table every time the formula is run.
  8. Click Save and Reload.

Add steps to a formula

Steps allow you to process a formula in successive stages and to use the output from a step as an input argument in subsequent steps.

For example, you can create a formula that calculates the premium amount in the first step, then use the result as an input in the second step to calculate the monthly payment installments (by dividing the premium amount to the number of months).

  1. In the formula screen, in the Formula Steps section, click Insert to add a step. This will open the Add Formula Step screen.

  2. Enter a Name for the step. The name must be unique in the formula (Two steps can be named the same, but must be in different formulae.) This name can be used in subsequent steps as an input argument.
  3. The Formula Id field is automatically populated with your formula name.
  4. Check the Exclude From Mapping checkbox if you want to disable the output parameter mapping for the step (see Formula Parameter Mapping for details). This is useful, for instance, if you wish to safely test your formula without affecting entries in the database.
  5. In the Master Type field select the data type for the step's result. This can be either Simple Type (a single value) or Collection (a set of multiple values).
    If the master type is a Collection, you will have to specify in the Number of Iterations field the formula argument that will be iterated to generate the collection.

    For example, to generate a collection with the first x numbers in Fibonacci sequence, use a whole number input argument called x for the number of iterations (make sure x is greater than or equal to 2) and use the following formula expression:

    “result[0] = 1;

    result[1] =1;

    result[i] = result[i-1] + result[i-2];”

    HINT  
    Where the formula body is complex, needs periodic update or must be simplified for transparency and traceability, we suggest you split it in separate steps, each with its own expression. This architecture allows calling the result of step N-1 in step N (“result = step 1 + a;”).
  6. In the Sub-Type field, enter the data type for the step's result:

    • Whole Number
    • Decimal
    • Boolean - only for Simple Type master types
    • Text - only for Simple Type master types
    • Object - only for Simple Type master types
  7. Calculation Type can be set as either Normal or as an Iteration, in which case you will have to specify the formula argument that will be iterated in your formula. Current Formula Step cannot be set as iteration argument.
  8. Enter the expression for the formula step in the Formula field. For details, see Formula Editor.
  9. Click Save and Close .
  10. Repeat for any additional steps you wish to include in your formula. The output from a step can be used as an input argument in subsequent steps.
    NOTE  
    New formula steps cannot be added on an active formula. To add steps to a formula create a new versioning (see Formula Versioning).

After you've added all the steps, click Save and Close .

HINT  
The order used for each step is indicated in the Oder Index column on the right in the grid.

Test Your Formula

You can create various tests for a formula to see how it performs.

To create a formula test:

  1. In the formula screen, in the Formula Tests section, click the Insert button to add a test.
  2. Enter a Name for your test.
  3. Enter a Reference Date for the test. By default this will be the current date and time. This allows you to test your formula with various data set versions, for instance with a data set that will become active in the future (see Data Set Versioning).
  4. The Formula field will be automatically populated with the formula name.
  5. Click Save and Reload. A new button will appear called ''Test Formula''.
  6. Edit the Input field with the desired input parameters. This field is filled in automatically with the input form the formula and with default values for each argument from this input. The user can just insert some values, not necessarily arguments.
  7. Click the Test Formula button at the top right corner of the page.
  8. Check the Execution Successful checkbox and the Output field to investigate the formula execution.

If the result is an error a new text box will appear. In the text box, the system will retrieve the reason for the error.

Formula Versioning

When you first create a formula, it will be in a Draft state, meaning that it can be edited and tested, but not used by the system. Users cannot create a new version from this state by clicking the button ''Create new version'' on the right-side of the screen.

Activate a Formula

To activate a formula draft, in the formula page, click the Next Status: Active field in the top left corner of the screen.

The activation stage implies new conditions for the formula:

  • it is possible to create a new version of the formula
  • the formula has at least one step
  • the form is readonly
  • when a versioned formula goes into Active status, the parent formula end date will be updated with the versioned formula start date and its status will be updated to Closed.
  • you can no longer update or delete the formula's input.
HINT  
You can still run a closed version of a formula with the server.formula.runFormula Server SDK method.
IMPORTANT!  
Once activated, you can revert an active formula to the draft status only if:
  1. Its start date/time is later than the current date/time.
  2. There is no other draft created in a newer formula version (see Create a New Formula Version Draft).

Otherwise, an active formula can only go into the Closed state.

Clone a Formula

After activation, you can create a clone of that formula by clicking the Clone button at the top-right corner of the screen.

This allows you create variations based on the same formula as a starting point.

Create a New Formula Version Draft

A formula that is currently in use cannot be modified. Instead, a ''Create New Version'' button will appear in the top right corner of your formula page. This button will allow anyone to create a new version of the same formula and a user will be able to make modifications for the new version. It will create a new version with start date today or the start date of the formula if it is in the future.

Click the Create New Version button to create a new Draft version based on the active formula. You can edit the draft version while the active formula is still enabled. It will have the same name as the original one, but the version number will be increased by one, and the start date will be current date, or start date of the previous version plus one day. To find the New Formula Version Draft, open the formula you wish to change and click the History tab where all modifications are shown.

NOTE  
The start date of the new version must be later than or equal to the current date and time (v22.1.1 or later).

Activate a Formula Version Draft

Once you finish updating the draft version, change its status from Draft to Active as shown in the Activate a Formula section. The previously active version will be set to a Closed state, and the draft version will become the currently active version.

You can track the formula versions in the History tab of the formula page.