Different use cases of Rule Editor
The article provides detailed examples of a Rule Editor for an Adaptive Form based on core components, providing insights into its proper implementation for different scenarios. The rule editor allows developers to define and manage the logic controlling the behavior of forms.
Now, let us discuss the different implementations for a rule editor.
Navigating among panels using button
The rule editor allows you to add navigation buttons to your panel layouts, such as Horizontal Tabs, Vertical Tabs, Accordions, or Wizard. These buttons enhance the user experience by simplifying transitions among different panels in a form, shifting focus to the selected panel.
Imagine you are interacting with the profile settings section of an application, where navigation is facilitated by buttons rather than tabs. Upon entering the profile settings from the main dashboard, you encounter a series of panels dedicated to different aspects of their profile: Personal Information, Account Security, and Notification Preferences.
Each panel contains relevant fields and options for updating specific information. Navigation buttons, such as Next
and Back
, are prominently placed allow you to move between these panels. Click Next
to advance the user to the Account Security panel and click Back
to return to the Personal Information panel. This method of navigation ensures a seamless transition between sections without losing context, providing a smooth and intuitive user experience. The use of navigation buttons simplifies the process of managing profile settings, making the interaction more organized and user-friendly.
You can use the Navigate among the panels
rule to create navigation rules for buttons that allow switching between different panels. Select the Shift focus to the next item
attribute to move the focus to the next panel in the layout.
When the Next
button is clicked, focus moves to the subsequent panel in the layout.
Similarly, you can create a rule for the Previous
button to shift focus to the preceding panel.
Streamline complex calculations in repeatable panels with functions
The rule editor allows you to use out-of-the-box functions like Sum, Min, Max, and Join directly on fields within repeatable panels. You can also pass a repeatable panel field value to the function that accepts number array, string array, boolean array etc. This unlocks powerful automation, allowing you to implement complex business logic without custom code.
Imagine a form with a repeatable panel, where each panel instance collects information about the declared value of assets.
You can use the Sum
function to automatically calculate the total assets value across all panels, eliminating the need for manual calculations and reducing the potential for errors.
When you fill out a form, adding instances to declare the asset values, the Calculate Asset Value
button computes the total sum of all declared asset values and displays the result in the total in assetvalue
textbox.
This is just one example! Explore the available functions to simplify workflows and enhance data accuracy within your forms.
Nested expressions nestedexpressions
Rule editor lets you use multiple AND and OR operators to create nested rules. You can mix multiple AND and OR operators in the rules.
The following is an example of a nested rule that displays a message to the user about eligibility for a child’s custody when the required conditions are met.
You can also drag-and-drop conditions within a rule to edit it. Select and hover over the handle (
Date expression conditions dateexpression
Rule editor lets you use date comparisons to create conditions.
The following is an example condition that displays a static text object if the mortgage on the house is already taken, which the user signifies by filling up the date field.
When the date of mortgage of the property as filled in by the user is in the past, the Adaptive Form displays a note about the income calculation. The following rule compares the date filled in by the user with the current date and if the date filled in by the user is earlier than the current date, the form displays the text message (named Income).
When filled date is earlier than the current date, the form displays the text message (Income) as following:
Number comparison conditions number-comparison-conditions
Rule editor lets you create conditions that compare two numbers.
Following is an example condition that displays a static text object if the number of months an applicant is staying at current address is less than 36.
When the user signifies living at the present residential address for less than 36 months, the form displays a notification that more proof of residence can be requested.
Invoke Form Data Model service invoke
Consider a web service GetInterestRates
that takes loan amount, tenure, and applicant’s credit score as input and returns a loan plan including EMI amount and rate of interest. You create a Form Data Model (FDM) using the web service as a data source. You add data model objects and a get
service to the form model. The service appears in the Services tab of the form data model (FDM). Then, create an Adaptive Form that includes fields from data model objects to capture user inputs for loan amount, tenure, and credit score. Add a button that triggers the web service to fetch plan details. The output is populated in appropriate fields.
The following rule shows how you configure the Invoke service action to accomplish the example scenario.
Triggering multiple actions using the When rule triggering-multiple-actions-using-the-when-rule
In a loan application form, you want to capture whether the loan applicant is an existing customer or not. Based on the information, user provides, the customer ID field should show or hide. Also, you want to set focus on the customer ID field if the user is an existing customer. The loan application form has the following components:
-
A radio button, Are you an existing Geometrixx customer?, which provides Yes and No options. The value for Yes is 0 and No is 1.
-
A text field, Geometrixx customer ID, to specify the customer ID.
When you write a When rule on the radio button to implement this behavior, the rule appears as follows in the visual rule editor.
In the example rule, the statement in the When section is the condition, which when returns True, executes the actions specified in the Then section.
Using a function output in a rule using-a-function-output-in-a-rule
In a purchase order form, you have the following table, in which users fill in their orders. In this table:
- The first row is repeatable, so users can order multiple products and specify different quantities. Its element name is
Row1
. - The title of the cell in the Product Quantity column of the repeatable row is Quantity. The element name for this cell is
productquantity
. - The second row in the table is non-repeatable and the title of the cell in the Product Quantity column in this row is Total Quantity.
A. Row1 B. Quantity C. Total Quantity
Now, you want to add specified quantities in the Product Quantity column for all products and display the sum in the Total Quantity cell. You can achieve this sum by writing a Set Value Of rule on the Total Quantity cell as shown below.
Validating a field value using expression validating-a-field-value-using-expression
In the purchase order form explained in the previous example, you want to restrict the user from ordering more than one quantity of any product that is priced more that 10000. To do this validation, you can write a Validate rule as shown below.
See Also
- Introduction to Rule Editor for Adaptive Forms based on Core Components
- Operator types and events in rule editor of an Adaptive Form based on Core Components
- Rule Editor User Interface for Adaptive Forms based on Core Components
- Different use cases of Rule Editor for an Adaptive Form Based on Core Components
- Difference in various editions of Rule editor
- Using asynchronous functions in an Adaptive Form
- Invoke Service enhancements in the Visual Rule Editor for forms based on Core Components
- Introduction to Custom Functions for Adaptive Forms based on Core Components
- Create a Custom Function for an Adaptive Form based on Core Components
- Scope object in custom functions
- Examples of developing and using a custom function