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.
  2. Select Business Formulas.
  3. Select Formula.
  4. Click the Insert button () at the top right corner of the page.
  5. Enter a Name for the formula.
  6. Select the Start Date at which the formula becomes active. Automatically, it sets the current date, but it is possible to change it. It selects the time as well.
  7. In the Formula Input field, select the set of arguments that will be processed by the formula (see Define Formula Inputs for details).
  8. The End Date and Version fields are populated automatically based on the formula's versioning. For details, see Formula Versioning.
  9. Click the Save and Reload () button at the top right corner of the page.

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 the Insert button 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 the Save and Close button () at the top right corner of the page.
  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 the Save and Close button () at the top right corner of the page.

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. Depending on the Reference Date that the user chooses, the engine will use the version of the formula that is active at the reference date.
  4. The Formula field will be automatically populated with the formula name.
  5. Click the Save and Reload button () in the top right corner of the screen. 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. User 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
  • it can only go into the Closed state. For any other changes to this formula, a new version needs to be created.

  • 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.

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

Once a formula has been activated, it 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 day. To find the New Formula Version Draft, open the formula you wish to change and click on the ''History'' tab where all modifications are shown.

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.