Content

Overview

Group Properties

Behavior

Validation

 

Variables Exposed in Group Properties

Group ObjectProperties

Objects Frame Context Menus for Groups

 

Overview

Top ../images/arwup.gif (846 bytes)

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

Top ../images/arwup.gif (846 bytes)

These define properties of the Group selected in the Editing frame or Objects frame.

Behavior

 
Property Description
Id Identifier of the Group.
title Alias for the Group Id. When you are providing feedback to the user, the Group Id is not friendly, so this is something they can understand.
Readonly Can be used to configure the Group as visible/invisible or readonly/readwrite based on entries made for other Form Objects. For example, "This Group is readwrite only if another Group is readonly.

If a Group is readonly, all fields in the Group are readonly. If a Group is visible, all fields in the Group are visible.

When a Group is hidden, all Fields in the Group are hidden.
When a Group is disabled (readonly), all Fields in the group are disabled.
Any Labels associated with a Field are also affected.

Values can be "Y", "N", or a Groovy expression. For example, assume the smoker field is a checkbox with values of "Y" or "N". The Group visibility or protection could be based on whether or not the checkbox is checked, e.g.,

fields.smoker == "Y" ? "Y" : "N"

or simply

fields.smoker

Visible
Value Rule Groovy expression that defines a rule to represent the value of that Group. You can then use this "Group value" during Form processing.

Red

  For example, a Group of three checkboxes can be put into a Group.

The Value Rule can do things such as return the semicolon-separated list of values, i.e.,

Red;Green;Blue

Green

 

Blue

 

Value Rule provides access to:

Group Field values via fields Map
Group members via members List
Group properties and functions via group object
Connection values via user Map
The database (read-only)
LabVantage Java API accessors in sapphire.accessor

The Group value...

Is stored with the field values in the DocumentField table.
Is always a String
Can be used in validation expressions.

Examples:

To concatenate the Field values of the Group:

fields.alkalimetals + ";" + fields.appearance + ";" + fields.assay

To return a semicolon separated list of the Field values in the Group:

group.valueList()

Those who require a comma separator can use:

group.valueList( "," )

To return the a list of custom attributes for checkboxes that are selected in the Group:

group.attributeList( "workitemid" )

 

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.
NOTE:The combined length of all Field entries in the Group must be less than 100 characters.

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:

Checked Count = 1, Greater than or equal to:
This means at least 1 checkbox must be checked.

Group Value= Appearance, no operator specified:
This means that one of the selected values must be "Appearance".
NOTE: "Value1" and "Value2" can be a Groovy expression. This lets you do things such as reference other Fields as part of the value, e.g., "value is greater than fields.fielda". Examples:

Value > $G{fields.dob}
Length >= $G{fields.autoreceive=="Y" ? 10:0} and <= 2

NOTE: "Entered Count" and "Checked Count" can be a Groovy expression, e.g.,

EnteredCount > $G{fields.maxentries}

Operation
Entered CountNumber of Fields in the Group that have a value entered.
Checked CountNumber of checkboxes that are checked in the Group.
Group ValueValue of the Group.
Entered Count and Checked Count
Example:
OperatorValue 1Value 2Entered value and number of checkboxes checked must be...
Greater Than20 >20
Less Than20 <20
Equal To20 =20
Greater Than or Equal To20 > or = 20
Less Than or Equal To20 < or = 20
Not Equal To20 not equal to 20
Inclusive Between202010<=x<=20
Exclusive Between202010<x<20
Inclusive Outside2020x<=10 or x>=20
Exclusive Outside2020x<10 or x>20
ContainsSemicolon-delimited list of values matching criteria.
Value and Operator: Example of Group Value
OperatorGroup ValueThe Group must contain one of these values:
ContainsRed;Green;BlueRed;Green;Blue
Error Message Message to display following validation failure. The message accepts the tokens groupid, title, groupvalue, operation, operator, value1 and value2. For example:

Group value [groupvalue] is invalid for group [groupid]

returns

Group value Yellow;Orange;Violet is invalid for group Colors

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

Field values via fields Map
Group Field values via groupfields Map
Group members via members List
Connection values via user Map
The database (read-only)
LabVantage Java API accessors in sapphire.accessor

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

Top ../images/arwup.gif (846 bytes)

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:

actionProcessor.processAction( actionid, version, props ) can be written as just processAction( actionid, props )
queryProcessor.getSQLDataSet( sql ) can be written as getSQLDataSet( sql )

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

Top ../images/arwup.gif (846 bytes)

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.