Content

Overview

Adding Fields to Forms

Overview

Using the Add Field Dialogs

About Labels

Field Descriptions

Field Properties

Behavior

Data

Lookup

Validation

Datasource Binding

Layout

Misc

 

Variables Exposed in Field Properties

Variable Descriptions

About the Database Object

Field Object Properties

Objects Frame Context Menus for Fields

Shortcut Toolbar for Fields

 

Overview

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

Fields are typically data input fields, but can also be hidden or readonly fields for processing or display purposes. In general:

Input fields are based on HTML input tags such as text, password, radiobutton, checkbox, and selection types.
Field Properties determine display, operation, and processing capabilities of the input (such as HTML input type, titles, labels, help), as well as declarative and complex validation for the field value.

As shown in Form Builder Overview, Field Properties are shown in the Properties frame.

Field Object Properties let you perform operations on the Field (such as add Fields to Groups).

As shown in Form Builder Overview, Field Objects are shown in the Objects frame.

 

Adding Fields to Forms

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

Overview

 
Fields are added to the Form using the Fields toolbar button.

You are first presented with an "Add Field" dialog.

When adding a Field, all Fields provide the properties described below. These properties are a subset of the Field Properties available in the Properties frame of the Form Builder.

Field  
Field Id Identifier of the Field (see Id). This is a unique reference used in expressions, validation and processing.
Field Type Shows the style of editing to use (see Field Type). This is not editable.
Field title Alias for the Field Id (see title).
Fill Container Makes this Field match the width of the parent object in which it is placed. For example, adding a field in a table cell with "Fill Container" checked sets the width of the field to the width of the table cell.
Width Field width in pixels (leave blank for auto).
Create Label Adds a Label to the Field. See Using the Add Field Dialogs and About Labels.
Label Text Text that can be associated with any Field (see About Labels).
Properties  
Mandatory Specifies entry requirements for the field (see Mandatory).
Data Type LabVantage Data Type used for validation and object definition (see Data Type).

The Properties tab for the Select, Lookup, Checkbox, and Radiobutton Fields contains a few other specialized properties as described below. These properties are a subset of the Field Properties available in the Properties frame of the Form Builder.

Field Additional Properties

Select

SDC Id See SDCId.
RefType Id See RefTypeId.
Values See Values.

Lookup

Lookup Page See Lookup Page.

Checkbox

Values See Values.

RadioButton

RefType Id See RefTypeId.
Values See Values.

Using the Add Field Dialogs

 

If you do not edit the automatically-assigned Field Id, advancing to the Field title retains the Field Id (below left). You can then enter your own Field title (below right).

Checking "Create Label" copies the Field title into the Label Text (below left). You can then change the Label Text if desired (below right).

If you edit the automatically-assigned Field Id, advancing to the Field title copies the Field Id into the Field title. You can then enter your own Field title if desired.

As in the first scenario, checking "Create Label" copies the Field title into the Label Text and allows you to change the Label Text.

After checking Create Label for any Field, the Field dialogs remember that you want to create a Label. Each time you add a Field, Create Label will remain checked until you uncheck it. In this case, the Field title and Label Text remain blank.

When you enter your Field title, advancing to Label Text copies the Field title into Label Text. You can then enter your own and Label Text.

About Labels

 

Labels are special Fields because they represent text that can be associated with other Fields.

Simply putting text next to a Field does not make it a "Label". When you create a Label, you can associate that text with any Field on the Form. In the example below, a Label that will be rendered as "Control Sample Id" is being associated with Field "textfield1". The "Field" is the title of the Label, which is an alias for the Field Id to provide user-friendly identification. Note that the dropdown lets you select the Field that is associated with the Label.

Whether you create a Label when adding a Field (as shown in Using the Add Field Dialogs), or you add a Label as shown above, you will see the Label in the Objects (top left) frame. This text, which can be anywhere on the Form, is associated with the Field you have selected. If this Field is hidden or disabled, the same fate will befall the Label.

You can associate multiple Labels with a Field. They can be anywhere on the Form. The fate of the Labels are linked to their associated Fields. A typical example of this would be...

Volume: 100 (ml)

...where "Volume" and "ml" are Labels associated with the Field for entering the volume.

Below is a more extreme example, where two Labels are in completely different areas of the Form but associated with the same text Field. Note that the Objects Frame shows the association between Fields and Labels.

These are the most important distinctions among Field Id, Label, and title:

A Field Id is an identifier for the Field's HTML input tag. It is a unique reference used in expressions, validation and processing.
A Label is text that is associated with one or more Fields.
A title an alias for the Field Id to provide user-friendly identification.

 

Field Descriptions

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

Here is a summary of the Fields available for use on a Form. Field Properties (the next section) describes configurable properties for all Fields.

Field Description
Simple "Simple" is the only Field that is not based on a Field Type. Simple Fields are based on LabVantage Editor styles. When compared to other Fields based on Field Types, using a Simple Field reduces the number of properties required to define the Field.

When you choose an Editor style, the Field value selection will be based on that. In the example below, the Field lookup is based on the "Samples" Editor style.

Text Inserts an HTML <input> tag and sets the Field Type to "text".
TextArea Inserts an HTML <input> tag and sets the Field Type to "textarea".
Formatted
Text
Inserts a text box that accepts HTML input. This allows a user to enter formatted text into a field. A basic formatting toolbar is provided by the Formatted Text Editor. Unlike other fields (which allow a maximum of 4000 characters), this accepts an unlimited number of characters. Formatted text is saved in XHTML format.
Password Inserts an HTML <input> tag and sets the Field Type to "password".
Select Inserts an HTML <input> tag and sets the Field Type to "dropdown".
NOTE: Note that the Edit style is "dropdown". The word "dropdown" is therefore used to refer to the "Select" Field to maintain consistency with LabVantage Field Types.
Date Inserts a LabVantage date lookup field and sets the Field Type to "date".
Lookup Inserts a LabVantage lookup field and sets the Field Type to "lookup".
File Allows a file from the local machine be defined as a field value.

The field is rendered in the eForm Manager as a text box accompanied by a ellipsis button:

Use the Browse button to locate the file.
After you "Submit" or "Draft" the Form, the selected file is uploaded. After uploading, the file can be viewed as a Field Attachment in the eForm Manager, and can be used in Form processing.
For security reasons, File Fields cannot have default values.
If a File Field is defined as an image, the image can be displayed and sized after uploading.
Field Attachments can be used in Form processing by generating a "documentfield" reference as the "value" of the field. Currently, the only Actions that support this reference are ImportDataFile and AddSDIAttachment. Addtionally, Groovy processing lets you directly access the file contents by getting the File object from the Field, i.e.,

object def file = fields.filefield1.getFile();

file.eachLine { logger.info( it ) }

Checkbox Inserts an HTML <input> tag and sets the Field Type to "checkbox". This Field uses the Data properties RefTypeId, SQL, or Values.
Radio Button You need to insert only one radiobutton. It will automatically render each Reference Value as a separate radiobutton. The Label is linked to all rendered radiobuttons. The Field Type is set to "radiobutton". This Field uses the Data properties RefTypeId, SQL, or Values.
Hidden Inserts an HTML <input> tag and sets the Field Type to "hidden".
Display Only Inserts an HTML <input> tag. The creation mechansim is the same as text, but the Field Type is set to "readonly".

 

Field Properties

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

The Properties frame for Fields defines properties of the Field selected in the Editing frame or Objects frame.

You can group and sort the display order of Field properties according to your requirements:

 
Sorting Groups/Sorts Fields by...
Categorized Areas of functionality.
Alphabetical Ascending alphabetical order.
Used & Unused Used and unused Fields.
Editor Type Editing classifications such as string, list, yes/no, collection.
No Grouping No grouping or sorting is applied.

Dragging and dropping fields in the Editing Frame restores Field properties and allows Undo operations, i.e., Field properties are maintained throughout drag and drop operations.

Field properties are categorized below along with their decriptions. In the Properties frame, the Form Builder is designed to show only the properties that can be used with the selected Field.

Behavior

 
Property Description Enabled with these Fields...
Id Identifier of the Field. This is a unique reference used in expressions, validation and processing. All.
title Alias for the Field Id. When you are providing feedback to the user, the Field Id may not be intuitive. "title" lets you provide something they can understand.

Do not confuse this with a Label.

All.
Field Type style of editing to use:
TypeDescription
simplefieldField based on the Editor style Id (see Simple Field for an example).
textHTML <input> tag of type="text".
dateLabVantage date lookup.
textareaHTML <input> tag of type="textarea".
lookup LabVantage page lookup.
NOTE:  If the Field Type is "lookup" and the Editor style Id (below) defines an Editor style "Lookup" mode that is set to "Dynamic Lookup", the Dynamic Lookup takes effect when entering input into the Form Field.
dropdownHTML <input> tag of type="select".
checkboxHTML <input> tag of type="checkbox".
radiobuttonHTML <input> tag of type="radiobutton".
passwordHTML <input> tag of type="password".
hiddenHTML <input> tag of type="hidden".
displayHTML <input> tag of type="readonly".
fileLabVantage file field.
formattedtextLabVantage formattedtext field.
All.
Editor style Id Editor style used for the Field value selection (see Simple Field for an example). All.
Data Type LabVantage Data Type (string, number, date, or dateonly) used to provide the default validation criteria and define object types in Groovy expressions and processing.

Data Type and Mandatory (below) are automatically checked on save.

All except "File".
Mandatory Specifies entry requirements for the field:
ValueDescription
Yes Field is mandatory.
NoField is not mandatory.
If VisibleField is mandatory only if it is visible.
If EnabledField is mandatory only if it is enabled.

Mandatory values must exist in order to save data. Validation errors on mandatory fields cannot be overriden.

This also accepts Groovy expressions that define "mandatory if . . ." conditions. Examples:

return fields.projectid.length() > 0 ? "Y" : "N"

This sets up a condition where "if projectid' has a value, the current field is mandatory."

NOTE: You can also write this as...

fields.projectid.length() > 0 ? "Y" : "N"

or simply as...

fields.projectid.length() > 0

NOTE: The return statement is optional in simple expressions. It is required if a statement block is created, e.g.,

if ( fields.projectid.length() > 0 ) {

return "Y"

} else {

return "N"

}

return fieldinstance.fielda.length() > 0 ? "Y" : "N"

This is a special case, where "fielda" is in a repeating section, and "fieldinstance" refers to the values in the current section instance.

To set the "If Visible" and "If Enabled" options, Groovy expressions should generate"V" to set "If Visible", or "E" to set "If Enabled".

All.
Visible Can be used to unconditionally configure the Field as visible (Yes) or invisible (No).

You can also use Groovy to show/hide Fields based on entries made for other Fields, e.g., this Field is visible only if another Field is readonly.

All.
Readonly Can be used to unconditionally configure the Field as readonly (Yes) or readwrite (No).

A third option (On Creation) allows a field to be readonly only when the Document is created, i.e., following a "save" event (Create, Draft, or Submit). This is typically used in Worksheet creation, when selection fields must be disabled when the Worksheet is created and fields are bound.

You can also use Groovy to enable/disable Fields based on entries made for other Fields, e.g., this Field is readwrite only if another Field is readonly.

To set the "On Creation" option, Groovy expressions should generate "C".

All.

 

Data

 
Property Description Enabled with these Fields...
Default Value Value (literal or variable) or Groovy expression to use as the default value. Default values can be any of the following:
Literal (such as MyProject)
[currentuser] (such as New sample added by [currentuser])
[currentdatetime]
[currentdate]
[contextvar]
This refers to one of the context variables for the page defined by the EForm Page Type.
A Groovy expression. You can use this to do things such as derive the default value from a SQL statement based on some other value in another Field.
All except "File".
SDC Id
Use Description
Radiobutton Fields

Dropdown Fields

Defines the SDC from which SDIs are returned for radiobutton and dropdown Fields. Value and display value are the same.

This also accepts a Groovy expression to provide features such as dynamic dropdowns (note that radiobuttons cannot be dynamic).

Autocheck property

Autolink property

Defines the SDC used to determine SDIs for these properties (see Autocheck and Autolink).
All except "Formatted Text" and "File".
SDC Restrictive From These are available after you have selected an SDC Id.

Defines a restrictive "from" clause or restrictive "where" clause when using the SDC property as the basis for a set of values. Rather than using a SQL statement, using these properties to qualify a list of SDC values implements LabVantage security for the set of retrieved values.

All except "Formatted Text" and "File".
SDC Restrictive Where
RefTypeId Reference Type that defines values returned for radiobutton and dropdown Fields. This is the actual value. The refdisplayvalue is used as the display value if it exists.

This also accepts a Groovy expression to provide dynamic dropdowns (radiobuttons cannot be dynamic).

"Dropdown" and "Radiobutton" only.
SQL SQL statement that returns values for radiobutton and dropdown Fields.

The first column is the actual value, the second column is the display value. Other columns are ignored.

This also accepts a Groovy expression to provide dynamic dropdowns (radiobuttons cannot be dynamic).

This property does not support LabVantage security unless it is built into the query.

"Dropdown" and "Radiobutton" only.
Values Semicolon-separated literal values to show for radiobutton and dropdown Fields, e.g., R=Red;G=Green;B=Blue.

This also accepts a Groovy expression to provide dynamic dropdowns (radiobuttons cannot be dynamic).

"Dropdown", "Radiobutton", and "Checkbox".
Value Rule

Uses a Groovy expression to generate a Field value. Example:

database.selectValue( "select projectdesc from s_project where s_projectid = '${fields.project}'" )

The Readonly property for the Field must be set to Yes.

Annotations and Followups are supported.

"Display Only".
Reconcile Defines a Field value that can be reconciled during Double Data Entry (DDE). This is available only if the Form supports DDE. All except "File" (DDE only).
NOTE: If values exist for the SDCId, RefTypeId, SQL, and Values properties, the precedence is:
1. SQL
2.Values
3.SDCId
4.RefTypeId

 

Lookup

 
Property Description Enabled with these Fields...
Lookup Page Identifier of the lookup page to use for lookup Fields. Use the URL browser in the dialog for building the required Request Controller syntax, e.g.,

rc?command=page&page=SampleList

You can also pass field ids into the lookup page, e.g.,

rc?command=page&page=SampleList&queryid=ByProject&param1=[projectid]

"Lookup" only.
Callback If you want to use your own custom JavaScript callback function, specify it here. "Lookup" only.
Selector Type Selector to use for items in a List page (radiobutton, checkbox, or none). "Lookup" only.
Lookup Columns Defines columns displayed on the lookup page:
ColumnIdIdentifier of the column.
titleText displayed on the lookup page to identifier the column.
Mode Specifies how the column is populated:
Display OnlyShow the value, but do not populate the column.
Return OnlyPopulate the column, but do not show the value.
Display and ReturnShow the value and populate the column.
Hidden OnlyHidden field.
Display ValueSemicolon-delimited values displayed in place of the retrieved values.
PseudocolumnColumn (other than a column defined in the database) that is rendered on the Form, but does not exist in the SDC.
Return into FieldIdentifier of the Field into which the retrieved value is written.
"Lookup" only.

 

Validation

 
Property Description Enabled with these Fields...
Max Length Defines a maximum length for data entered in a field (providing free text entry is permitted). This is a shortcut for the length validation option, but additionally blocks entry in a field when the maximum length has been reached.

The value of this property can be bound to a database table column using the expression

ddt:tablename.columnname

For example, this expression sets Max Length to 80:

ddt:s_sample.sampledesc

"Text", "Textarea", and "Formatted Text" only.
Simple Validation Provides an interface to assist in defining rules for validating Field values (such as "length must be greater than 4 characters and between 1 and 9, otherwise show an error message"). Field validation is executed "live" during data entry. You can define multiple validation rules for a Field.

1. Adds a validation rule.
2.Moves rules up and down.
3.Deletes a validation rule.
4.Copy (adds a validation rule that is a duplicate of the current rule).
Operations
Operation
Check LengthChecks the integer length of the entered string.
Check ValueChecks the entered data value.
NOTE: "Value 1" and "Value 2" 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: These rules apply to the equality operators below (Equal To, Greater than or Equal To, Less Than or Equal To, Not Equal To, Inclusive Between, Exclusive Between, Inclusive Outside, Exclusive Outside):
If Data Type = number, values must be numbers.
If Data Type = string and a number is entered, values must be numbers.
If Data Type = date, values must be absolute or relative dates (such as now/n, today/t, startweek/sw).
Validation Available with "Check Length" and "Check Value"
OperatorValue 1Value 2Entered value 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 Between102010<=x<=20
Exclusive Between102010<x<20
Inclusive Outside1020x<=10 or x>=20
Exclusive Outside1020x<10 or x>20
Validation Available with "Check Value"
OperatorValue 1
In

Not In

Use "In" and "Not In" only with the "Check Value" operation, and specify only "Value 1". The dropdown in "Value 1" offers these choices, but you can also enter your own value:
TypeExample
Semicolon-delimited list

LIST:valuelist

LIST:Red;Green;Blue
Reference Type

REFTYPE:reftypeid

REFTYPE:Priority
SDC

SDC:sdcid

SDC:Project
SQL statement

SQL:sqlstatement

SQL:select s_projectid from s_project
Regular Expression

REGEX:expression

REGEX:\d{3}-\d{2}-\d{4}

Note that DDT:tablename:columnname is visible, but must be used only as described below in "Validation Available with 'Check Length'".

Validation Available with "Check Length"

You can validate length against a database column by specifying "Check Length", any Operator except "In" and "Not In", and "Value 1". For example:

OperatorValue 1Value 2Validation
Less ThanDDT:sysuser.sysuserid SysUserId must be less than 20 characters in length.

You can validate length against a database column by specifying "Check Length", any Operator except "In" and "Not In", and "Value 1". "Value 2" is the column identifier. For example:

OperatorValue 1Value 2Validation
Inclusive Between5DDT:sysuser.sysuserid Value must be at least 5 characters, but no greater the length of the SysUserId column.
Other Options
Message
Message displayed following validation failure. The default message is "validation error".

You can also place these tokens in messages: fieldid, title, enteredtext, operation, operator, value1 and value2. Examples:

[enteredtext] is an invalid [title]

returns

Xyz is an invalid Project

[title] must be greater than [value1]

returns

Count must be greater than 10

Enabled
Specifies conditions under which field validation is enabled. This can also be a Groovy expression.
ValueDescription
Yes Field validation is always enabled (default).
NoField validation is always disabled.
If VisibleField validation is enabled only if the field is visible.
If EnabledField validation is enabled only if the field is enabled.
All.
Script Validation Alternative to Simple Validation. Provides a facility to write Groovy script that defines Field validation.

Groovy 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
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. This example checks if a Project has been entered and, if so, checks to see if it is Active:

fields.project.length() > 0 ? database.selectValue

( "select projectstatus from s_project where

s_projectid = '${fields.project}'" ) == "Active" : true

NOTE: Note the use of the GString ${fields.project}, which builds the string dynamically using the fields object.
All.
Pass Condition Groovy script that defines a "pass" condition. The validation fails and the Message (below) is generated if the return value from the script does not equal the Pass Condition. All.
Message Message displayed if validation fails. This can be static or dynamic.

These tokens are available: fieldid, title, enteredtext.

All.
Enabled Specifies conditions under which field validation is enabled:
ValueDescription
Yes Field validation is always enabled (default).
NoField validation is always disabled.
If VisibleField validation is enabled only if the field is visible.
If EnabledField validation is enabled only if the field is enabled.

This can also be a Groovy expression.

All.
Autocheck Makes certain entered text is a valid SDC, Reference Type, or Value by validating entered text against these:
For SDCs, the SDCId property must be defined, e.g., Project. The SDI Key Id Fields are automatically populated with the Field Id.
For Reference Types, the RefTypeId property must be defined, e.g., Priority.
For Reference Values, the Values property must be defined, e.g., high;medium;low.
All except "File".
Key Id 1 Field

Key Id 2 Field

Key Id 3 Field

SDI Keys used for mapping Fields to SDC columns.

These properties appear when either the Autocheck or Autolink property is enabled (see Autocheck and Autolink).

All except "File". Not used with "Formatted Text".

 

Datasource Binding

 
Property Description Used with these Fields...
Binding Mode Used only with Worksheet Forms to bind a Field to a specific row and column in a Datasource result set. See these topics:

eForms Worksheet Principles

Datasources

Field Binding

eForms Worksheets Advanced Concepts
All except "File".
Bind Error Used only with Worksheet Forms to define behavior of a Field if it cannot be successfully bound. See Bind Error in eForms Worksheet Principles. All except "File".

 

Layout

 
Property Description Used with these Fields...
Help Help text displayed at the bottom of the form. All.
Suppress Repeating Prevents the field from repeating if its value is the same as the prior field value in the Datasource. "Text" only.
View Image File Allows a file field to be displayed as an image after it has been uploaded by a Draft or Submit.

"File" only.
File Image Width Allows the width of the image of an uploaded file field to be defined. The View Image File property must be set to Yes. "File" only.
File Image Height Allows the height of the image of an uploaded file field to be defined. The View Image File property must be set to Yes. "File" only.
Radio Type For radiobutton Fields, determines whether to layout the radio buttons in a horizontal or vertical array. "Radiobutton" only.
Radio Group For radiobutton Fields, specifies the Group of radio buttons to which this radio button belongs.

You assign radio buttons to a Group when you want them to work together. For example, suppose you have 10 radio buttons on the Form. 4 could be in one Group that defines "Color", while 6 could be in another Group that defines "Texture". You would than use this property to assign each radio button to its relevant Group.

"Radiobutton" only.

 

Misc

 
Property Description Used with these Fields...
Instrument Type If the field value will be populated by an Instrument, this is the Instrument Type (see Simple Instruments). All.
Instrument Id If the field value will be populated by an Instrument, this is the identifier if the Instrument (see Simple Instruments). All.
Identity Field An "Identity Field" indicates that the Field makes this Form unique.

When a Form becomes a Document, it is identified by a unique DocumentId. However, this falls short of identifying a Form under all circumstances. For example, the combination of a Study and a Participant may constitute a unique entity. If you make both Study and Participant Id Fields, you could lookup these Fields using an identifier, or use them to determine if this Form already exists. This is particularly useful when doing Double Data Entry.

During data entry, if you enter a value for an Identity Field, then "Draft" or "Submit" the Document... and a Document already exists with this value for this Field... the eForm Manager tells you that you cannot enter the same value.

Identity Fields become mandatory Fields during data entry.

All.
Autolink Links Documents based on this Form to other SDIs (through the SDIDocument table). For example, you could associate Documents based on this Form to a specific Sample.

By defining an SDC using the SDC Id property, you can setup multiple Fields for autolinking (adding records into the SDIDocument table on save) and autochecking (automatically validating data).

The SDI Key Id Fields are automatically populated with the Field Id.

Be advised that the "Processing Rules" specified for the Form Definition let you use an Action to make such an association. However, Autolink makes this easier in most situations. Suppose you have a Project on this Form and whenever you enter the ProjectId, you want to automatically associate the current Document with that Project. In this case, Autolink automatically sets up this link through the SDIDocument table. This can be extended to also update a column in the Document table to provide the link.

All except "File".
Auto Attach Adds Field Annotation Attachments to a Field that is linked to an SDC (see Attachments in the eForm Manager).

For Fields that are not bound to a Datasource (no Autosave), you must set the SDC Id and the Key Id Fields properties. For example, if the Field defines a Project, all Field Annotation Attachments are automatically associated with the Project as well as the Field.

For Fields that are bound to a Datasource (Autosave), the linked SDC is defined by the Datasource result set to which the field is bound. For example, if the Field is bound to a data entry record, the Field Annotation Attachments are associated with the Data Item as well as the Field.

All.
Processing Field Defines a Field that cannot have any validation errors or Followups prior to Form processing. Although processing can proceed if there are outstanding items on the Form, Processing Fields are key to processing. As such, they cannot be missing, invalidated, or pending action during processing. All.
Save Field Value Specifies save behavior for the field:
ValueDescription
Yes Field value is explicitly saved (default).
NoField value is not saved.
If VisibleField value is saved only if the field is visible.
If EnabledField value is saved only if the field is enabled.

To set the "If Visible" and "If Enabled" options, Groovy expressions should generate"V" to set "If Visible", or "E" to set "If Enabled".

Records will still be generated in the DocumentField table for unsaved field values, but the field value will be blank.

All.
Attributes Opens a dialog where you can specify an identifier and value to use in Group values, or any Processing Rules that you define for the Form.

For example, suppose you have a Group of checkboxes. You can specify an identifier and value for each checkbox (such as Id = WorkitemId, Value = Alkali Metals). When processing, you then know the Workitem to create for each box that is checked using:

group.attributeList( "workitemid" )

You can create as many attributes for a Field as you like. The key is that you use these attributes when you are processing the form.

All.
Show Toolbar Enables/disables a field popup toolbar. By default, all fields display a popup toolbar when the mouse hovers over the field (except "Hidden" and and "Display Only" field types). All.

 

Variables Exposed in Field Properties

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

Variable Descriptions

 

These variables are exposed when evaluating Field properties:

Variable Description
fields

Map containing the Fields of the Form. The value of the Map entry is a Field object that has its own API. However, for most cases, the syntax will be:

fields.fielda

This is not a String object. It is a shorthand that returns a String object from the Field value. Depending on the data type, the Field value is stored as a String, BigDecimal, or Calendar object.

To get the native object, use something like this example:

fields.dob.value

Whereas fields.dob returns a String representation of the dob (date of birth), fields.dob.value returns a Calendar object.

fieldinstance Map containing the Fields of the current sectioninstance. This is used when you have repeating Sections and intra-section expressions.
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 1 below.
database DBRead object that provides readonly access to the database. See Note 2 below.
actionProcessor

queryProcessor

sdcProcessor

Standard LabVantage Java Public API Accessors (see Note 3 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 Field properties:

1. The "logger" variable is exposed only when evaluating Complex Validation properties.
2. The "database" variable is exposed only when evaluating Complex Validation properties. See About the Database Object below.
3. The accessor variables are exposed only when evaluating Complex Validation properties.

About the Database Object

 

The database object is available when evaluating Complex Validation properties for Fields and Complex Validation properties for Groups. The database object has these Groovy-oriented methods, which provide readonly access to the database:

Method Example
String getDbms() if ( database.getDbms().equals( "ORA" ) )…
boolean isOracle() if ( database.isOracle() ) …
boolean isSqlServer() if ( database.isSqlServer() ) …
boolean exists( sql ) if ( database.exists( "select s_projectid from s_project where s_projectid = '" + fields.project.toString() + "'" ) ) …
int count( sql ) int projects = database.count( "select count(*) from s_project " )
String selectValue( sql ) This returns a single value... the first column in the select clause, e.g.,

String desc = database.selectValue( "select projectdesc from s_project where s_projectid = '" + fields.project.toString() + "'" )

selectString()

selectDate()

selectNumber()

Returns String, Calendar and BigDecimal types (respectively).
HashMap selectRow( sql ) This returns a Map of values selected, e.g.,

HashMap project = database.selectRow( "select * from s_project where s_projectid = '" + fields.project.toString() + "'" )

void eachRow( sql, closure ) This is a very Groovy-centric implementation (the closure process), but it allows you to iterate over the rows of a select, e.g.,

database.eachRow( "select * from s_project " ) { project -> logger.info( project.s_projectid + ", " + project.projectdesc ) }

 

Field Object Properties

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

Objects Frame Context Menus for Fields

 

Fields shown in the the Objects Frame have Context Menus that perform operations on the Field.

Right-click "Fields":

Menu Item Description
Expand Expand/collapse (if any Fields exist).
Collapse

Right-click a Field:

Objects Frame Context Menu for Fields
Menu Item Description
Expand Expand/collapse (if any items are associated with the Field).
Collapse
Save As Field Saves the Field as a Field Definition (see Field and Formlet Definitions). The field in the Form is marked as a "controlled vocabulary" field and honors the new settings for the Field Definition.
Add to Group Opens a dialog that lets you add the selected Fields to a Group:
Existing Group IdIf you want to add the selected Field to an existing Group, select the Group Id.
New Group IdIf you want to add the selected Field to a new Group, specify the new Group Id.
Field IdDisplays the Id of the selected Field.

Multiple Fields can added to a Group by using Ctrl-Click to select multiple Fields, then right-clicking and selecting Add to Group.

Remove from Group Opens a dialog that lets you remove the Field from a Group:
Group IdSelect the Group Id.
Field IdDisplays the Id of the selected Field.

Use the arrows to change the order of Fields in the Object Frame:

Multiple Fields can also be moved. Use Ctrl-Click to select multiple Fields, then use the arrows to change the order.

Shortcut Toolbar for Fields

 

Clicking a Field in the Editing Frame opens a shorcut toolbar to provide these functions:

Add To Group

See Objects Frame Context Menus for Fields above.

Insert Label

See Form Builder Fields → About Labels.

Edit Field

Opens an abbreviated version of the "Add Field" dialog (see Adding Fields to Forms) that lets you change the Field title and select the "Fill Container" option.

Save As Field

See Objects Frame Context Menus for Fields above.

Refresh
Controlled Field

Reloads a Controlled Field.