SchemaField - class to represent and manipulate a schema field
Shane P. McCarron <shane@aptest.com>
Copyright 1999-2011 Applied Testing and Technology, Inc. All Rights Reserved.
use Schema; use SchemaField; # create a schema object $schema = new Schema(suiteName); # get an individual field $field = $schema->field(fieldName); # get the prompt for a field $prompt = $field->prompt();
The SchemaField object is used by Schema objects to access and manipulate their fields. It is also available directly to applications, should they need to access the attributes of a schema field.
$field = new SchemaField(hash);
Creates a new SchemaField object and associates its attributes with the object.
a hash of field attributes
returns a reference to the SchemaField object.
$name = $field->name();
$schemaH = $field->parent();
$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.
$field->calculated() ;
$field->cantSelect();
$field->canSearch();
@descs = $field->descs( [ $valStr ] );
valStr is an optional string of comma-separated values. If supplied, the description list is updated.
Returns a list of descriptions.
$desc = $field->descOf($value [, $annotate] ) ;
value is the value to describe.
annotate inidicates whether the description should be annotated if the item is marked as obsolete.
Returns the associated description if the variable is a list. If value if a reference to an array, then returns a reference to an array of descriptions.
$mapRef = $field->descMap() ;
Returns a reference to a hash that maps values to descriptions. Caches the map so that subsequent lookups are faster.
$flags = $field->getFlags();
Returns a value for the FLAGS field of a field.
$field->hidden();
If there are hRules defined for the field, highlight the data that matches those rules.
$output = $field->highlight($input) ;
input is a string to highlight.
Output is returned with any matching data highlighted.
If there are hRules defined for the field, mark the data that matches those rules, ready for doHighlight() later.
$output = $field->highlight( input, displayStr );
input is a string to highlight.
if displayStr is specified, then if input matches a rule, display displayStr instead, highlighted. This is used for menu fields.
Returns input (or displayStr, where appropriate) with matching areas bounded by \03 and \04.
$output = $field->doHighlight( value );
value is the string to process.
Returns value, after replacing \03 and \04 (inserted by prepHighlight) with HTML for applying highlighting.
If the field is markup, doHighlight also escapes the markup so the field is displayed "as is".
$graphable = $field->graphable();
$status = $field->hRules(pattern [, isCaseSensitive [, isRE]]) ;
pattern is the pattern to highlight.
isCaseSensitive indicates the pattern is case sensitive (defaults to no).
isRE indicates the pattern is a regular expression (defaults to no).
Returns 1 if successful, 0 if it failed for some reason.
$field->isBulkEditable();
$field->inHistory( [ fname ] );
fname - the name of the field.
$field->inTable( [ fname ] );
fname - the name of the field.
$field->isDate() ;
Returns 1 if the field is date only, 2 if it is a date/time field, and 0 if it is neither.
$field->isList();
$field->isNamepart()
Returns true if this field is part of the name.
$field->isNumber() ;
Returns true if it is numeric, and false if it is not.
$field->isRange();
$field->isMarkup();
$field->isTable();
$field->isText();
$field->isImportable();
Returns false for table fields, and any built-in fields marked as not importable, and true for anything else.
$label = $field->label();
$searchable = $field->searchable();
$selectable = $field->selectable();
$field->fixFlags() ;
Returns nothing.
$field->setFlags(flags);
Returns nothing
$size = $field->size(size);
Returns the current size of the field.
$size = $field->sizeAsHtml(limit);
returns a string suitable for use in the appropriate input element.
$type = $field->type();
$importable = $field->importable();
$prompt = $field->prompt();
$cal = $field->valueOf($desc) ;
desc is the value to describe.
Returns the associated value if the variable is a list. If desc if a reference to an array, then returns a reference to an array of descriptions.
$mapRef = $field->valMap() ;
Returns a reference to a hash that maps descriptions to values. Caches the map so that subsequent lookups are faster.
@vlist = $field->values( [ $valStr ] );
valStr is an optional string of comma separated values to store.
Returns a list of values derived by splitting the stored comma-separated string. Caches the results of the split for use in subsequent calls.
@vlist = $field->valuesList( [ $lRef ] ) ;
lRef is an optional reference to a list of values. If supplied, the stored list of values will be updated.
Returns a list of values.
$style = $field->style();
$visible = $field->visible();
Really a no-op, since this object does not have a database.
my $val = $field->SQL_value($val) ;
Returns the value of the field after interpretation by TestDB object.
$value = $field->WHATEVER(); $value = $field->WHATEVER(newvalue);
Updates the setting of the WHATEVER attribute. Returns the current or new setting.
Copyright © 2000-2013 Applied Testing and Technology, Inc. All rights reserved.