NAME

ApTest::Base::Fields - base class for generic field methods

AUTHOR

Shane P. McCarron <shane@aptest.com>

COPYRIGHT

Copyright 2001-2016 Applied Testing and Technology, Inc. All Rights Reserved.

SYNOPSIS

use ApTest::Base::Fields ;

use base qw( ApTest::Base::Fields ) ;

METHODS

asHtml - render a field in HTML format

$output = $field->asHtml($value [, $oval] ) ;

value is the value to render.

oval is a supporting value that will be used as a URL when interpreting atm_prid fields.

Returns the content, annotated according to its style.

compare - compare two values of a field

$res = $field->compare(val1, val2) ;

val1 and val2 are values from the field.

This function behaves differently depending upon the field type. For text fields, the style determines whether the contents are compared as numbers or strings.

For menu fields, the "ordered" flag and the field's style work together to determine how the comparison is done. If the field has the "ordered" flag set, then the comparison is done by comparing the ordinals of the values' positions in the list of field values. Otherwise, if the style of the field is plain the comparison is done as text. If the style of the field is numeric, the comparison is done as numbers.

Returns the results of the comparison (-1 if val1 < val2, 0 if they are equal, and +1 if val1 > val2).

default - get/set the default value for a field

$default = $field->default();

editable - is a field editable

my $bool = $field->editable() ;

Returns true all the time - override in the real class if there are fields that cannot be edited in the graphical field editor.

isObsolete - is a value marked obsolete

$field->isObsolete(value) ;

Returns true if the value is tagged as obsolete.

isOrdered - is this field ordered in a user-defined way

$field->isOrdered() ;

returns true if the ordered flag is set for this field.

parent - reference to the parent object.

$pRef = $field->parent() ;

$field->parent( $self ) ;

Returns a reference to the parent object (the object that owns this field. Returns NULL if the parent is not defined.

obsolete - accessor for list of obsolete values

@oList = $field->obsolete( val1, val2...) ;

vals passed are captured as obsolete values.

ordinal - return the ordinal of a value in a field

$ord = $field->ordinal($val) ;

val is a legal value for the field. The field is typically a list field that has a collection of user-defined values. The field may also be the "id" field, in which case the val is assumed to be the path of a folder or file, and the cooresponding ordinal is discovered by querying the underlying database.

serialize - return a serialized representation of this field

my $string = $self->serialize() ;

Returns a stringified version of this object suitable for inclusion in the SCHEMA file. Values are emitted in the order

NAME TYPE STYPE SIZE LABEL FLAGS VALUES

visibleValues - return a list of values to show

@vals = $field->visibleValues( curRef )

curRef is a reference to a list of currently selected values for the field.

Returns the list of values representing the following:

FieldValues - ( obsoleteValues XOR @$curRef )

If curRef is not defined, or the target of the reference is an empty list, then all values marked as obsolete will be removed from the list of available values.

xlsFormat - generate an Excel Spreadsheet format

$format = $field->xlsFormat( workbook ) ;

workbook is a reference to a worksheet object.

Creates a new format within the worksheet that supports the data in the field. Returns a reference to the format so that it can be used to set the format for a field or a column.

xlsDataValidation - generate an Excel Spreadsheet validation

$fmtHash = $field->xlsDataValidation() ;

Returns a reference to a hash of excel data validation constructs or undef if the field requires no validation.

SQL_fieldTable - return the name of the table a field is in

my $tName = $field->SQL_fieldTable( ) ;

Returns the name of the SQL table in which the field is stored.

SQL_searchClause - return a SQL comparison clause for a field selector

my $clause = $field->SQL_searchClause( selectorRef [, usingGlobal] ) ;

selectorRef is a reference to a hash with the selection pattern.

usingGlobal is a boolean - if true, a global search is underway

Returns a SQL-compatible WHERE clause that implements that pattern.

Copyright © 2000-2013 Applied Testing and Technology, Inc. All rights reserved.