Is Null Or Empty
When the “ISNULLOREMPTY” function is executed, it checks if an element, attribute, system variable, or other object type contains a NULL value or is empty. If an element, attribute, system variable, or other object contains a NULL value or is empty, this function returns “true” as a Boolean value.
You can use the ISNULLOREMPTY function with other sub modules. You can use it in many scenarios. A few of these scenarios are as follows:
- Implement a condition in the business rule
- Check the response of an API
- Check the value of a system variable
- Check the value of an attribute
- Check the value of a specific index in the enum object
The following section describes how to use the ISNULLOREMPTY function to check the value in the element.
Configuring ISNULLOREMPTY function on Element
Assume you want to configure the ISNULLOREMPTY function so that you can check if the user has entered a value in the input field. To implement this scenario, assume you add two elements on the application page. These elements are an input field and a push button.
Assume you want to implement a functionality that displays an error message if the end user clicks the Submit button to submit the data without entering the name in the Name input field. To implement this functionality, you first need to create a business rule that will check if the input field is empty. You can configure the business rule as follows:
Configuring a Business Rule
To configure a business rule:
- On the vDesigner module’s dashboard, see the left navigation panel.
- Put the mouse pointer on the left panel to expand it.
- In the left panel, click Business Rules to display the Business Rules page.
- On the Business Rules page, click Create Business Rule to display the Create New page.
- On the Create New page, in the middle panel, in the Name box, enter the new business rule’s name (for example, Check Input Data).
- In the right panel, see the IF block.
- Under the IF block, click in the When box to display the Search box.
- In the Search box, scroll right through the list of tabs and then click the Functions tab.
- After you click the Functions tab, enter static in the Search box to display the Static function.
- In the list, click the Static function to display it with the value and String parameters.
- In the Static function, click the value parameter and then enter true in the place of the value parameter.
- In the Static function, click the String parameter and then click Boolean in the context menu to select it.
- After you click Boolean, the When box displays the Static function with the true and Boolean as parametric values.
- In the IF block, click the middle box, and then select the equal to (==) operator to compare two conditions in the business rule.
- Click in the right box to display the Search box.
- Under the Search box, scroll right through different tabs and then click the Functions tab.
- After you click the Functions tab, enter isnullorempty in the Search box to display the ISNULLOREMPTY function.
- In the list, select the ISNULLOREMPTY function.
- In the ISNULLOREMPTY function, click the path parameter to display the Search box.
- Under the Search box, click the Element tab.
- Click in the Search box, and then enter the reference name (for example, InputField_24114) of the element to check the value in it.
- After you enter the reference name (for example, InputField_24114) of the element, the list displays the element’s reference name.
- In the list, select the element’s reference name to define the second condition in the business rule.
- Click Create to successfully create and configure the business rule.
Creating a New Taskgroup
After you create and configure the business rule (for example, Check Input Data), you need to create a task group. In the task group, you will map the business rule property to the business rule (for example, Check Input Data) so that when the user’s action satisfies the condition in the business rule, the application will execute the task group to perform the expected function.
To create a task group:
- On the vDesigner module’s dashboard, see the left navigation panel.
- Put the mouse pointer on the left panel to expand it.
- In the left panel, click Task Groups to display the Task Groups page.
- On the Task Groups page, click Create Task Group to display the Create Task Group dialog box.
- In the Create Task Group dialog box, enter the name of the task group (for example, validmsgtask), and then click Enter to create the validmsgtask task group.
- In the validmsgtask task group, under the Task tab, search and find the Display Message task.
- Drag the Display Message task to the Execution panel.
- Under the Display Message task, in the Select Message box, click the application tree icon () to display the Message Library panel.
- In the Message Library panel, select the message that you want to display if the end-user does not enter a value in the Name box (To see the Name box, click here) .
Note:- To create and configure a new message, see the post, Creating a New Message.
- After you click the message to select it, click Select to map it to the currently selected task (for example, Display Message).
- In the Business Rule box, click the application tree icon () to display the Business Rules panel.
- In the Business Rules panel, click the business rule (for example, Check Input Data) to map it to the currently selected task.
- After you select the business rule, click Select to map the business rule to the currently selected task.
- After you configure the Display Message task in the validmsgtask task group, click Save in the right panel to configure the validmsgtask task group.
Linking Task Group to Submit Button
After you implement the ISNULLOREMPTY function in the business rule and then map the business rule to the task group, you need to link the task group to an element. When the user performs the function on the element (for example, the Submit button), the ISNULLOREMPTY function will return the true or false Boolean value.
Thus, application will perform the function based on the returned Boolean value.
To link the task group to the element:
- On the vDesigner WYSIWYG canvas, click the element (for example, Submit button) to link it to the task group.
- After you click the element (for example, the Submit button), the Button property panel comes into view.
- In the Button property panel, click the Events icon () to display the list of events.
- In the list of events, click the plus icon () right to the onClick event, and the Event Configuration page opens.
- On the Event Configuration page, see the Task Group panel.
- In the Task Group panel, search and find the task group (for example, validmsgtask) that you want to link to the element.
- After you find the task group, drag it to the Execution panel.
- After you drag the task group to the Execution panel, it displays the task(s) configured under the task group.
- After you drag the task, click Save to link the task group to the element.
The End Result
After you implement the ISNULLOREMPTY function in the business rule, map the business rule to the task group, and link the task group to the element, the application performs the function based on the implemented rule.
If the user enters a value in the Name box and then clicks the Submit button, the ISNULLOREMPTY function returns a false Boolean value. As a result of this, the user action does not satisfy the condition in the business rule. Because the user’s action does not satisfy the condition in the business rule, the Display Message task will not display the error to the end user.
If the user does not enter a value in the Name box and then clicks the Submit button, the ISNULLOREMPTY function returns the true Boolean value. As a result of this, the user action satisfies the condition in the business rule, and then the Display Message task will display the error message to the end user.