9.11.3 Filter definition

You specify a filter definition (FilterDefinition tag) as a child element of a CB definition for editing (DataEditCBDefinition tag) described in 9.9.3 CB definition for editing.

For details about record filtering processing, see 10.4 Record filtering.

Organization of this subsection
(1) Format
(2) Details of definition
(3) Example

(1) Format

<FilterDefinition>
 <record source="name-of-record-to-be-filtered"
  conditionName="record-condition-name" condition="{AND|OR}">
   <field source="field-name"
    condition="{eq|ge|gt|le|lt|ne}" value="condition-value"/>
 </record>
</FilterDefinition>

(2) Details of definition

FilterDefinition tag (all definition information)
Defines all filter definition information. You specify this definition only once.
record tag (definition of record condition)
Defines a record condition. You can specify a maximum of 10 record condition definitions. This definition is mandatory.
A record condition is one of the conditions for selecting records to be filtered. For the record condition, specify the records to be filtered.
source="name-of-record-to-be-filtered"
Specifies, as 1 to 100 single-byte alphanumeric characters and the underscore (_), the name of a record to be filtered, which must be in the record format passed from the callback that was processed before the record filtering. This record name must begin with a single-byte alphabetic character.
You can specify this attribute only once.
conditionName="record-condition-name"
Specifies a name for the record condition, as 1 to 100 single-byte alphanumeric characters and the underscore (_). This name must begin with a single-byte alphabetic character.
You specify this definition only once. The specified name must be unique within the FilterDefinition tag.
condition="{AND|OR}"
Specifies the logical operation for the record condition. If this attribute is omitted, AND is assumed.
The permitted values are as follows:
  • AND
    Outputs as the results the records that contain a field that satisfies all the field conditions.
  • OR
    Outputs as the results the records that contain a field that satisfies any of the field conditions.
field tag (definition of field condition)
Specifies a field condition. You can specify a maximum of 10 field condition definitions. This definition is mandatory.
A field condition is one of the conditions for selecting records to be filtered. You specify for a field condition the name of a field in the records to be filtered, a comparison operator, and a condition value.
source="field-name"
Specifies the name of a field, which must have the record format specified for source in the record tag, expressed as 1 to 100 single-byte alphanumeric characters and the underscore (_). This field name must begin with a single-byte alphabetic character.
This attribute cannot be omitted.
condition="{eq|ge|gt|le|lt|ne}"
Specifies the value that represents the desired comparison operator for the field condition.
The specifiable values depend on whether character data or numeric data is specified in the value attribute in the field tag, as shown in the table below. If this attribute is omitted, eq is assumed.
Value of this attributeComparison operatorValue of value attribute
Character dataNumeric data
eq=YY
ge>=NY
gt>NY
le<=NY
lt<NY
ne!=YY
Legend:
Y: Can be specified
N: Cannot be specified
The table below explains the comparison operators.

Comparison operatorUsage exampleMeaning
=A = BA is equal to B
>=A >= BA is equal to or greater than B
>A > BA is greater than B
<=A <= BA is equal to or less than B
<A < BA is less than B
!=A != BA is not equal to B
value="condition-value"
Specifies the condition value for this field condition, expressed as character data or numeric data. The permitted characters for character and numeric data are shown below. This attribute cannot be omitted.
  • For character data
    You can specify 1 to 128 characters.
    You can use a regular expression for the character string. Because the java.util.regex.Pattern class is used to analyze the regular expression, you must specify a regular expression that is within the range supported by the java.util.regex.Pattern class.
    To use a character that has a special meaning in a regular expression, you must use the backslash (\) as an escape character.
    The following are the characters that have a special meaning in regular expressions:
    (, ), [, ], ., *, ?, +, ^, $
  • For numeric data
    You can specify an integer in the range from -9223372036854775808 to 9223372036854775807.

(3) Example

<?xml version="1.0" encoding="UTF-8"?>
<root:AdaptorCompositionDefinition
<!-- Omitted -->
xmlns:filter="http://www.hitachi.co.jp/soft/xml/sdp/adaptor/definition/callback/FilterDefinition">
<!-- Omitted -->

<!-- CB definition for editing -->
<cb:DataEditCBDefinition class="jp.co.Hitachi.soft.sdp.adaptor.callback.dataedit.filter.FilterCBImpl" name="filter1">
 <!-- Filter definition -->
 <filter:FilterDefinition>
   <!-- Definition of record condition -->
   <filter:record source="R1" conditionName="filterName1" condition="AND">
     <!-- Definition of field conditions -->
     <filter:field source="F11" condition="ge"  value="1"/>
     <filter:field source="F11" condition="le"  value="100"/>
     <filter:field source="F21" condition="eq"  value=".*MIKE.*"/>
   </filter:record>
   <!-- Definition of record condition -->
   <filter:record source="R2" conditionName="filterName2" operator="OR">
     <!-- Definition of field conditions -->
     <filter:field source="F21" value="1"/>
     <filter:field source="F22" condition="ne"  value=".*CATHY.*"/>
   </filter:record>
 </filter:FilterDefinition>
</cb:DataEditCBDefinition>