Class PBEFormatFilter

Object
  |
  +--PBEAction
        |
        +--PBEAttributeAction
              |
              +--PBEFilter
                    |
                    +--PBEFormatFilter

public class PBEFormatFilter
extends PBEFilter


Description:
PBEFormatFilter can be used to declare the input and output formats for values of common datatypes, such as date, time, timestamp, etc.

For output a single format definition can be declared and for input one or more format definitions can be declared, according to which data conversion will take place.

For example it is possible to allow various input formats for a single attribute, which can help making applications more flexible and as such more userfriendly.


Event String Action Name:
format


Syntax:

format( type, format_definition )

format( type, format_definition | format_definition )

format( type, format_definition | format_definition | ... )


Parameters
type - specifies the type of input expected or the type data should be converted to before being output.

Allowed values for type include date, datetime, decimal, float, money, time, timestamp.

format_definition - one or more format definitions. Declares how data should be parsed on input and how data should be formatted on output respectively.

Any of the format strings as described in the "PrimeBase DAL Reference", section "A.1 Format Control Variables" can be used in this parameter.


Examples:
 PBE:attributeEvent(
   "myForm",
   "creationDate",
   "before:output:format( datetime, 'DD.MM.YYYY hh:mm XM' )" );
 
In this example an attribute event is declared on the attribute "creationDate" of object "myForm". This event gets triggered before this attribute is output.


 PBE:attributeEvent(
   "invoice",
   "when",
   "before:input:format( date, 'DDMMYY|DDMMYYYY|DD.MM.YYYY' )" );
 
In this example an attribute event is declared on the attribute "when" of object "invoice". This event gets triggered before input is assigned to this attribute.

With this attribute event the allowed input formats for this attribute are set to "DDMMYY", "DDMMYYYY" and "DD.MM.YYYY".

Parsing is done in order of occurence. If input does not match any of the specified formats, an error is generated.


 PBE:attributeEvent(
   "songs",
   "duration",
   "before:output:format( decimal, '9999[.9]' )" );
 
In this example an attribute event is declared on the attribute "duration" of object "invoice". This event gets triggered before this attribute is output.


 PBE:attributeEvent(
   "songs",
   "duration",
   "before:input:format( decimal, '9999[.9]|9999[,9]' )" );
 
In this example an attribute event is declared on the attribute "duration" of object "songs". This event gets triggered before input is assigned to this attribute.

With this attribute event the allowed input formats for the specified attribute are set to "9999[.9]" and "9999[,9]".

Parsing is done in order of occurence. If input does not match any of the specified formats, an error is generated.


Fields inherited from class PBEAction
iParameters, iType, name, procName
 
Constructor Summary
PBEFormatFilter()
           
 
Method Summary
 varchar parameters()
           
 
Methods inherited from class PBEFilter
actionArguments, actionCall, checkEvent, performParameterCount, tracePerform
 
Methods inherited from class PBEAction
actionParameters, attributeReference, callString, getObject, methodReference, nestedInput, objectReference, parameter, perform, printPerform
 

Constructor Detail

PBEFormatFilter

public PBEFormatFilter()
Method Detail

parameters

public varchar parameters()
Overrides:
parameters in class PBEAction