0

Router Node

  • updated 10 mths ago

Description

A Router node is similar to a rule in that it evaluates the state of a data object and directs the user or system to the correct next step. Unlike a Rule, however, a Router offers more outcome paths than just true or false. You can use a Router to direct a logicnet to follow multiple paths depending on the values of the data object evaluated.

Node Type: A router is a system-facing node.

Used With: Routers are used in all logicnets and framework types.

Example of Use: Simple Router

If you have an application that shows a radio list of the three states in which your company sells paper, you can ask your customer to select the state in which he or she lives. If the user selects Arizona, the router can take the user to the path for buying paper in Arizona. If the user selects Colorado, the router can take the user to the path for buying paper in Colorado. There is no limit to the number of selection options you have when you use a router.

Example of Use: Advanced Router

Your application asks the user a number of questions, each one giving a score of 0, 1, or 2. You calculate the total score, and need to show different content for those with scores above 10 and different content again for those users who scored less than 4. The advanced router will evaluate the correct path based on the conditions entered.

Tips and Tricks

Once you create the available options in the router editor and click the type of node you want to connect to from that router, the system inserts the steps in the order in which they are listed in the Router Editor.

Check the Evaluate Conditions option to use with discrete or continuous variables. Output labels indicate the possible pathways and conditions, for example $(object)>=1 and $(object)<=4 are evaluated to determine the active pathway through the logicnet. Remember that conditions are evaluated in order, so later conditions do not need to exclude earlier conditions.

Use the options on the input field to insure non-valid inputs are excluded. For example, making a field a numeric input will insure the object will only contain numbers. Use validation to insure numbers are entered within a valid range (e.g. above 0 and below 100). Then the conditions do not need to take into account values outside of this range.

Editor Fields

The router editor contains the following fields to define the router.

Field Name Description/Use Optional/Mandatory
Object Path This is the name of the data object the system will evaluate. Click … to see a list of data objects available in the data model. Note that this field is mandatory unless the "evaluate conditions" mode is checked and more complex conditions are used for evaluation of the pathway. Mandatory
Default Output If the user does not select a choice in the radio button or dropdown list and clicks Next, the system will follow the path noted in this field. If you want to ensure a user follows a particular path, you can type that output value in this field. Optional
Evaluate Conditions Checking this box forces the router to evaluate the conditions specified in the table below. Optional
Columns When Evaluate Conditions is NOT checked, this is the table of potential values of a discrete data object. For example, if you are checking which item a user selected in a radio button list, the outputs should match one or more of the values assigned to each item in the radio button element that populates the data object. Selecting the data object from the Data tab using the [...] will prepopulate all the possible answers. Anytime the object path contains a value NOT listed, the default route will be taken.

When Evaluate Conditions is checked, this is a table of labels and conditions for a discrete or continuous data object (see Setting Conditions (Data Validation) for complete information on writing conditions). The system evaluates conditions in order during runtime, and the pathway label with the first condition met becomes the active route through this node. The default output is automatically added in the last position after all other conditions.

Note that the default output label does not have a condition specified, so it will automatically be selected if no conditions higher up the list are satisfied.
Mandatory

Typical Conditions

You can set conditions in v7.4.6+, by using the Rule editor (see Rule node article for more information). This is the recommended approach for new Designer Users, and is accessed via the R button. Clicking opens a pop-up window with the standard rule editor.

You can access the Conditions editor is accessed via the C button. You can write these manually using the appropriate syntax highlighted below. Some simple examples of conditions might be as follows (see Setting Conditions article for more examples and explanation):

  • $(object) <=5
  • $(object) ==10 or $(object)==20
  • $(object) >2 and $(object)<=4
  • '$(text_object)'=='red' (note syntax difference)

Note that the router considers each condition IN TURN, and will select the first one that evaluates to TRUE. Therefore, care should be taken in making sure earlier conditions in the list are specific, while later conditions can technically be broader. An example of this is below:

  • $(test) <=1
  • $(test) <=2 will trigger if the variable is greater than 1 and also 2 or less
  • $(test) <5 will trigger if the variable is greater than 2 and less than 5. It will NOT trigger if test is less than 2 because the earlier condition will be met first

Note as well that if a data object IS specified in the object path field, this can be referred to as :val in any conditions to be evaluated :val can be mixed in with other data objects from the context too, as shown below:

  • :val <=1
  • :val <=2
  • :val >2 and $(other_object) ==0
  • $(other_object) ==1

Example

Download and import this example project in your workspace for a working model of the router node.

Reply Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
Like Follow
  • 2 yrs agoLast active
  • 164Views
  • 2 Following

Home