Skip to content
Sahi Pro Flowcharts is retired. These pages document the last release (v12) and are no longer updated. Go to the current documentation.Flowcharts is retired. Current docs
Get Free Trial
Sahi Pro Flowcharts is retired. These pages document the last release (v12) and are no longer updated. Go to the current documentation.

Precondition Matching

Precondition Matching is a powerful feature of Flowcharts. When dealing with complex flows, Precondition Matching allows us to separate the setup steps from the business rules.

A path can define its preconditions via the Condition node. When a path is to be executed, Flowcharts will check if there are any conditions. If these conditions are on state attributes, Flowcharts will look for other paths which can satisfy the precondition. To satisfy, the other path should have an Outcome node with an expression which satisfies the precondition.

Eg.

Precondition Matching - Product Coupon

If Create Coupon has a Condition $product.exists==true?
And Create Product has an Outcome $product.exists=true
Then: When we Automate Create Coupon, we will see the sequence of paths.

Path sequence - Product Coupon

When Create Coupon is run, Create Product will run first and then Create Coupon will run.
We call paths which run as part of precondition matching as prepaths. In this case Create Product is a prepath.

Example 2: User Re-registration should fail

Precondition Matching - User Re-registration

Path Sequence - User Re-registration

Constant Attribute Condition matching is ensured in Precondition Matching also:

Constant Attribute for Multi Path Branching

  • Specifying a screen name in an Action node will force navigation to that screen.
    Eg. Adding an Action node with just @registration will add a Keyword of Navigate from @base to @registration.
  • If the previous path was at @homepage screen, a keyword Navigate from @homepage to @registration will be added.
  • While traversing a path on the UI, if the screen changes automatically, that screen name can be specified in an Outcome node
    This tells Flowcharts that the current screen has changed, and the correct Navigate keywords will be added.
  • Specifying [login=$user] in an Action node, forces the system to logout any existing user and login as this user.
    Keyword Navigate from @current_screen to @login_screen will be added.
    Keyword Login $user will be added.
  • Specifying [login=none] in an Action node, forces the system to logout any existing user.
    Keyword Navigate from @current_screen to @logout_screen will be added.
    Keyword Logout will be added.
  • While traversing a path on the UI, if the logged in user changes automatically, that loggedin state can be specified in an Outcome node.
    Eg. [login=none], [login=$user2]
    This tells Flowcharts that the current loggedin state has changed, and the correct Login/Logout keywords will be added.

To have 2 (or more) entity instances of the same type in a single path, add a number suffix. Eg. $user and $user2
Eg. Make $user manager of $user2
The suffix just lets Flowcharts know that these entities should be treated as different instances in this path. The suffix is ignored while matching prepaths.

Prepaths for $user and $user2

Notice how Create User path is traversed twice - once for $user and again for $user2.

Only the Dataset attached to the last path will be honored. Any datasets attached to prepaths with be ignored.

Next: Overriding Behavior