Form Builder: Groups |
Content |
|||||||||||||||
|
Overview |
|
|
A Group is a logical collection of related Fields. For example, 3 radiobuttons called "Red", "Green", and "Blue" could be put into a Group called "Color".
Fields in a Group can be anywhere on the Form (they need not be contiguous).
Like Fields, Groups have an identifier and title (used in messages), and can also have a value. You can apply validation to a Group, generate the value associated with a Group, do complex validation defined by Group properties, and conditionally hide and protect a Group.
• | To add/remove Groups, use the Objects Frame Context Menus for Groups. |
• | To add/remove Fields to/from a Group, use the Shortcut Toolbar for Fields. |
Group Properties |
|
|
These define properties of the Group selected in the Editing frame or Objects frame.
Behavior |
Validation |
You can use Groovy to return various operations that define "pass" conditions and return error messages. This actually reads from the database, but cannot update the database.
Property | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Simple Validation | Allows enforcement of rules for Fields in a Group, such
as "at least 1 Field in the Group must have an value entered"
or "only 2 checkboxes must be checked". You can define multiple
validation rules and specify that a message be returned and displayed in
the eForm Manager Review Panel.
You can use "Declarative Validations" or (for custom functionality) Script Validation (below), which lets you use Groovy expressions. Declarative Group Validation is not executed "live" during data entry; it is executed only in response to a document operation (such as Check, Draft, Submit). Declarative Group Validation is done through the interface shown above. Examples:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Script Validation | Groovy expression that returns various operations to define
a Pass Condition (below).
Groovy Group validation is not executed "live" during data entry; it is executed only in response to a document operation (such as Check, Draft, Submit). Groovy Script provides access to
The return value is used as a comparison to the Pass Condition. Example: def list = new StringBuffer() members.each { field -> list.append( field.value ) } return list.length() > 50 ? false : true |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Pass Condition | Groovy expression that defines the "pass" condition. The validation fails and the Message is generated if the return value from the script does not equal the Pass Condition. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Message | Error message to return from the Groovy expression. You
can use these tokens in messages: fieldid, title, groupvalue. Example:
Group value [groupvalue] is invalid for group [groupid] returns Group value a;b;c is invalid for group Tests |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Enabled | Enables/disables Group validation. Unlike Field validation, this property is not Groovy-based. |
VariablesExposedinGroupProperties |
|
|
These variables are exposed when evaluating Group properties.
Variable | Description | ||||
fields | Map containing the fields of the Group. | ||||
group |
Group object that provides some API utilities for the current group, e.g., group.attributeList( "workitem" ) See Note 1 below. |
||||
members | List of the fields in the Group. | ||||
user | Map containing string values of the connection details. For example, user.sysuserid is the current user. | ||||
logger | Logger object for logging to sapphire.log. These log entries are also maintained and returned from the script, and ultimately saved in the ProcessingLog column of the SDIDocument table. See Note 2 below. | ||||
database | DBRead object that provides readonly access to the database. See Note 3 below. | ||||
actionProcessor
queryProcessor sdcProcessor |
Standard LabVantage Java Public API Accessors (see Note 4 below). Example: DataSet projects = queryProcessor.getSQLDataSet("select * from s_project " ) Note that there are shorthands for a number of the common methods. Here are some examples:
|
When evaluating Group Properties:
1. | The "group" variable is not exposed when evaluating Script Validation properties. |
2. | The "logger" variable is exposed only when evaluating Script Validation properties. |
3. | The "database" variable is exposed only when evaluating Script Validation properties. |
4. | The accessor variables are exposed only when evaluating Script Validation properties. |
Group Object Properties |
|
|
Objects Frame Context Menus for Groups |
Groups shown in the the Objects Frame have Context Menus that perform operations on the Group.
Right-click "Groups":
Menu Item | Description |
Expand | Expand/collapse (if any Groups exist) |
Collapse | |
Add Group | Adds a Group. |
Right-click a Group:
Menu Item | Description |
Expand | Expand/collapse (if any items in the Group) |
Collapse | |
Remove Group | Removes the Group. |
Right-click a Field in a Group:
Menu Item | Description |
Remove from Group | Removes the Field from the Group. |