Creating table object filters  Formatting filter functions

Chapter 3: Building Production Objects

Creating built-in filters

Built-in filters executes against the data in the current blob and replaces the data in the blob with the result. If the function returns false—zero (0), the filter fails.

When you select Built-in, the only field you see initially is the Name field. Enter the name of the built-in function you want to use or click the ellipsis button to open the Built-in Filter Functions window and make a selection.

Depending on the built-in function you select, arguments may be required, in which case, additional fields display.

The Built-in Filter Functions window displays all of the pre-supplied functions in groups that identify their purpose. For example, all functions in the Date/Time list perform some kind of conversion or translation on date and/or time values.

You must know the type of data you expect to process to correctly use the built-in filter functions.

Current blob area

For all dynamic routing filter functions, the current blob area references the data that the filter receives. Exactly what the filter receives is dependent on how and when you use it.

Filters always receive the current blob area in the form of a blob.

Where filter is selected

“Current blob area” reference

Component pre-filter

Temporary work area containing the data in the selected field object, literal, group, or datalink object.

Component post-filter

Temporary work area containing the output generated by any of the rule’s components that ran before this component; plus, the output generated by this component’s pre-filters; plus, the output generated by any post-filters that ran before the current filter.

Rule post-filter

Temporary work area containing the combined output of all the current rule’s Components.

Production object post filter

Output area that contains the entire data stream assembled from all the current production object’s rules. Especially useful for adding on protocol data.

Return values

When a built-in filter function fails, its filter object fails and writes information about the cause of the failure to the production object’s error log.

When the dbDelete, dbInsert, dbSelect, loadFile, logger, shellCmd, and writeFile built-in filter functions fail, also included in the error log is the negative value of the UNIX error number for the problem that caused the method to fail.

WARNING! You cannot use the octal value “\000” in a filter’s arguments to indicate a null value. Use “\NUL” to place a null character into a filter argument.

StepsCreating built-in filter functions

  1. To select a function in the Built-in Filter Function window, double-click a function or select a function and click OK.

  2. Click Cancel to return to the Filter Information window without accepting the your selection.

    Function categories include:

Category

Description

Formatting

Help perform basic formatting actions on the output data.

Editing

Edit the current blob area’s data in some way, like adding data to it, or eliminating data or extra spaces. Some filter functions in this section allow you to use octal escape sequences or ASCII characters. When using octal escape sequences in a filter’s arguments, you must use “\NUL” instead of “\000” to indicate a null value.

Text Manipulation

Manipulate the data content of the current blob area.

NoteIf a field filtered by text manipulation functions has a zero length, the filter function returns zero (0). The SFM treats this return as a failure. To allow a zero length on a field:

  • Use a rule-level error function to trap this condition and force a continuation of processing.

  • Use rule-level qualification to skip the entire transaction.

  • Provide a default value in the related field object.

Date and Time

Append the date and/or time in a specific format to the current output blob area.

Miscellaneous

These functions do not fit in any of the other categories, but perform useful functions, like conversion of EBCDIC data to ASCII and vice versa, sending data through mail, and so on.

TDM Related (dynamic routing)

Built-in dynamic routing functions. These functions allow you to add, delete, or specify destinations for the transaction that were not originally part of the transaction’s route. When you use dynamic routing (TDM related) filter functions, note that:

  • You can use only destinations or a distributed SFM that is already defined to the local SFM through ID records in the SFM’s configuration file.

  • If one of the destinations you add or specify is a NullDest, or if the ID record in the configuration file specifies a NullDest, only the NullDest is used. Other destinations are ignored.

  • If the SFM does not recognize a destination or distributed SFM as valid, the transaction fails production object qualification. These filter functions do not change the SFM configuration file in any way.

  • A dynamic routing function can only be used as part of a post-qualification rule. Any other rule that uses a dynamic routing function is ignored.

  • When a transaction qualifies for multiple production objects, and one or more of those production objects uses dynamic routing, the SFM rejects the transaction.





Copyright © 2005. Sybase Inc. All rights reserved. Formatting filter functions

View this book as PDF