DataField class

Package: com.tecit.TFORMer.Repository

Provides access to DataField information.

Usage and notes

Overview

A DataField is a place-holder for dynamic content in a FormLayout. One FormLayout can use an arbitrary number of DataFields (0..n). TFORMer Designer requires that a DataField is defined before it can be used. This definition takes place directly in the FormLayout (in the case of a stand-alone FormLayout) or in a user-defined Project (or the GlobalProject ) of a Repository.

A DataField can be printed as text, as bar-code or may be used to provide the filename for image elements in the FormLayout. Besides this, a DataField can be used in element expressions and printing conditions.

Data Type

The type of a DataField influences its use in expressions within a FormLayout and the conversion method when reading a DataField from a JobData. 3 different data types are supported:

  • Text
    A text (string or character). This is the recommended data type.

  • Long
    An integer number. When reading a DataField of this type from a JobData it is converted automatically to an integer.

  • Float
    A floating point number. When reading a DataField of this type from a JobData it is converted automatically to a floating point number.

  • Invalid
    Invalid, internal use only.

Numeric conversion is permissive and can ignore non-numeric characters. Validate numeric strings in your application if strict format checking is required.

Naming Conventions

A DataField name must begin with an ASCII letter (A to Z or a to z) or an underscore. The remaining characters may be ASCII letters, digits (0 to 9) or underscores. Spaces, tabs, hyphens, accented letters and other special characters are not allowed. See Naming Rules for naming rules and examples.

Usually DataField names are not suitable for representing them to end-users. Refer to additional properties like Caption, Description, Comment and DisplayOrder for such purposes.

Data Field Values

For printing a FormLayout it is required to provide the DataField values via JobData. When a JobData is used to pass data to TFORMer SDK and a DataField is not set by this JobData the value of the DataField will be an empty string ("") or 0 (see also JobData.setReuseValues).

Data Field Default Values

The DefaultValue is the standard value of a DataField. The DefaultValue is only used by TFORMer Designer.

Validating DataFields

A validation rule is an expression that checks whether a DataField value meets a condition. Define the rule and its validation message in the FormLayout or Repository with TFORMer Designer (recommended). You can also set ValidationRule and ValidationMessage programmatically through the DataField interface.

Validation rules are evaluated when records are read during output generation. If a rule is violated, the SDK reports an error and includes any configured validation message in the additional error information. Use TFormerException.getInformation() for the additional error information.

TFORMer Designer displays an error message for invalid data.

DataField Enumeration

To iterate through the available DataField objects, use Project.getFirstDataField and DataField.getNext.

To find a DataField by name, use Project.getDataField.

If you want to know, whether the returned DataField is actually used in the FormLayout use the method FormLayout.getDataFieldUsage.

To determine if a specific DataField is used in a FormLayout iterate all data-fields of the Project and query the usage:

  // Enumerate all DataFields in the Project
  for (DataField field = project.getFirstDataField (); field != null; field = field.getNext ())
  {
    // Query the DataField usage in the given FormLayout
    DataFieldUsage usage = formlayout.getDataFieldUsage (field.getName ());

    // may the DataField value be set (this depends on the usage of the DataField within the FormLayout)
    if (usage == DataFieldUsage.Normal)
    {
      // Do something
    }
  }

Attention

The DataField is only valid as long as it is available in the Project. If it is removed from the Project all instances of the DataField immediately become invalid.

Methods

MemberDescription
dispose()Returns: void

Releases the resources allocated by this instance.

dump(PrintStream)Returns: void

Dumps the current instance into a text stream.

getCaption()Returns: String

Gets the caption of the DataField.

getComment()Returns: String

Gets the comment of the DataField.

getCriteria()Returns: boolean

Gets a flag indicating whether this DataField should be used as a criteria for a print-job (TFORMer Server).

getCriteriaColumn()Returns: int

Gets the criteria column of the DataField (TFORMer Server).

getCriteriaFormat()Returns: String

Gets the criteria format of the DataField (TFORMer Server).

getDefaultValue()Returns: String

Gets the default value of the DataField.

getDescription()Returns: String

Gets the description of the DataField.

getDetails(DataFormat)Returns: String

Gets the details of the DataField.

getDisplayOrder()Returns: String

Gets the display order of the DataField.

getEditMode()Returns: DataFieldEditMode

Gets the edit mode of the DataField.

getInitialValueSource()Returns: DataFieldInitialValueSource

Gets the initial value source of the DataField.

getName()Returns: String

Gets the name of the DataField.

getNext()Returns: DataField

Gets the next DataField defined in the Project.

getType()Returns: DataFieldType

Gets the type of the DataField.

getValidationMessage()Returns: String

Gets the validation message of the DataField.

getValidationRule()Returns: String

Gets the validation rule of the DataField.

setCaption(String)Returns: void

Sets the caption of the DataField.

setComment(String)Returns: void

Sets the comment of the DataField.

setCriteria(boolean)Returns: void

Sets a flag indicating whether this DataField should be used as a criteria for a print-job (TFORMer Server).

setCriteriaColumn(int)Returns: void

Sets the criteria column of the DataField (TFORMer Server).

setCriteriaFormat(String)Returns: void

Sets the criteria format of the DataField (TFORMer Server).

setDefaultValue(String)Returns: void

Sets the default value of the DataField.

setDescription(String)Returns: void

Sets the description of the DataField.

setDisplayOrder(String)Returns: void

Sets the display order of the DataField.

setEditMode(DataFieldEditMode)Returns: void

Sets the edit mode of the DataField.

setInitialValueSource(DataFieldInitialValueSource)Returns: void

Sets the initial value source of the DataField.

setName(String)Returns: void

Sets the name of the DataField.

setType(DataFieldType)Returns: void

Sets the type of the DataField.

setValidationMessage(String)Returns: void

Sets the validation message of the DataField.

setValidationRule(String)Returns: void

Sets the validation rule of the DataField.

toString()Returns: String

Returns a string representation of the instance.

Search documentation

Search in
More scopes
Additional scopes

All contents