Product Documentation

Appendix B - XDD Schema Structure<filter> filters element

FairCom RTG COBOL User Guide

Previous Topic

Next Topic

<filter> filters element

The <filter> element defines the rule identifying records belonging to a schema. The filter element will contain only one of the operator elements specified below. Every filter element should match with a $XFD WHEN clause.

<table>

<filters>

<!-field tags>

<filter>

</filter>

</filters>

</table>

The filters element is used to specify how records will be filtered between the various record schemas, as SQL tables may only have one record schema defined per table.

FairCom RTG COBOL - Every filter element should match with a $XFD WHEN clause.

Operator Elements

Element

Description

<eq>

If this tag is used the filter will be based on an equal comparison.

<neq>

If this tag is used the filter will be based on a not equal comparison.

<lt>

If this tag is used the filter will be based on a less than comparison.

<lte>

If this tag is used the filter will be based on a less than or equal comparison.

<gt>

If this tag is used the filter will be based on a greater than comparison.

<gte>

If this tag is used the filter will be based on a greater than or equal comparison.

<other>

If this tag is used the filter will match any record not matching any other filter.

<always>

If this tag is used the filter will always match.

Logical Operator Elements

Logical operators can be used to make complex rule expressions for filtering records into tables.

Attribute

Description

<or>

Logically OR together two filter rules. Only two rules can be OR'd together. Use nested techniques to OR more than two rules.

<and>

Logically AND together two filter rules. Only two rules can be AND'd together.Use nested techniques to AND more than two rules.

<not>

Logically exclude a value from a rule. Applies one per filter.

Mandatory Attributes

Attribute

Description

number

An increasing number to uniquely identify filters.

table

The name of the SQL table which will be generated by this filter rule. It requires a <schema> element with the same name.

Examples

A filter creating two tables, one a key-value pair and another with a full schema for every record in the table

<filters>

<field name="CM_CUSTNUMB" offset="0" size="4" type="Alphanum" />

<filter number="0" table="customer">

<always>

</always>

</filter>

<filter number="1" table="customer_kv">

<always>

</always>

</filter>

</filters>

A filter with logical operators

<filters>

<field name="field1" offset="10" size="32" type="Alphanum" />

<field name="field2" offset="90" size="32" type="Alphanum" />

<filter number="0" table="control">

<eq>

<field>field1</field>

<value>"NEVER"</value>

</eq>

</filter>

<filter number="2" table="combined">

<or>

<or>

<eq>

<field>field2</field>

<value>"value1"</value>

</eq>

<eq>

<field>field2</field>

<value>"value2"</value>

</eq>

</or>

<eq>

<field>field2</field>

<value>"value3"</value>

</eq>

</or>

</filter>

</filters>

See Also

TOCIndex