Required Attributes and Variables

WorkWithPlus provides the possibility to determine if an attribute or variable will be required. In other words, it will determine if user at runtime will be able to leave the field empty or not. You can also specify if an attribute or variable will be required due to a condition.

This functionality applies for both attributes and variables.In order to enable this option you have to set the Is Required property of the attribute or variable to 'true':

 

RequiredAttributesImg01

Scenario 'Is Required'  in a Transaction

When you set an attribute as Is required, two things will happen. The first one is that WorkWithPlus will assign a different theme class to the required attribute, so that the user at runtime can distinguish the attributes that are required from the regular ones:

RequiredAttributesImg02

The second thing that happens is that WorkWithPlus will add an error rule for each required attribute:

RequiredAttributesImg03

The message that is displayed for each required attribute is centralized in the WorkWithPlus Settings, within Labels node "Required Attribute':

RequiredAttributesImg04

So if you have a group of developers you don't need to agree wich message is going to be used for required attributes. You just have to set this property as true and then if you want to modify this message you only have to modify it once and all the messages of all the application will be updated automatically when building the apllication (or reapplying the pattern).This helps the developer to standarize the application as all the messages would be the same.

You can also set a condition to specify when the attribute or variable would be required and when not.

For example, if we want the person Home Address to be required when the PersonIsHomeAddressRequired attribute is True we should add the following condition:

RequiredAttributesImg05

In this way, the error rule will be triggered only if the PersonIsHomeAddressRequired is True:

RequiredAttributesImg06

If you need to use a different error message for a specific attribute, you can set that message in the property 'Is required error message':

RequiredAttributesImg09

The value <default> means that the message will be taken from the WorkWithPlus Settings --> 
Labels --> Required Attribute property.

You can also define a message by using a variable or procedure, if the message is written with the format as shown below:

RequiredAttributesImg10

Scenario 'Is Required' in a Web Panel

When you have a variable in a Web Panel created based on a template, and you want to set it as required, you have to change its property 'Is Required' to True.

RequiredAttributesImg07

It will assign the same Theme classes as it does on the Transaction scenario, but instead of adding an Error rule, it will create a subroutine where will check for all the variables that are required and display a message for each one that is empty. It will set in a boolean variable the result (if all the required fields are ok or not).

RequiredAttributesImg08