Performing complex filtering

A description and examples of complex filtering.

Description of complex filtering

For complex filtering, the text file specified in the REQUIRED_ATTRIBUTE_FILE property must contain the fully qualified attributes in the Retail_Item business object that must be present and not NULL or BLANK, conditionally specified by complex filters.

The first line of the file must contain a separator of FILTER or FIELDS. The file can contain any number of sections, each section containing FILTER and FIELDS subsections. Filterless FIELDS subsections can also be included.

Each FILTER subsection filters on one or more business object attributes. A FILTER subsection contains the following:
  • A fully qualified business object attribute name on a single line.
  • On the next single line, a comma-delimited list of valid values for the attribute.
  • If filtering on multiple attributes, on the next single line, a value of AND.
  • On the next single line, another fully qualified attribute name.
  • On the next single line, a comma-delimited list of valid values for that attribute.

Any number of attributes can be filtered in this way.

Each FILTER subsection must be followed by a FIELDS subsection. A FIELDS subsection must contain the required attributes for the filter above it, each attribute on a separate single line. A FIELDS subsection can be followed by a FILTER subsection, another FIELDS subsection without a filter, or an optional END separator at the end of the file. If a FIELDS subsection is specified without a FILTER subsection in front of it, the list of attributes in that FIELDS subsection is always required.

The collaboration object reads the file until it finds a FILTER subsection that is satisfied by the attribute values contained in the business object being processed. The File Missing Attribute logic employs an external Java™ class called RetailUtility in the Java package com.ibm.wbi.retail.utils to determine if the required attributes listed in the FIELDS subsection of the satisfied filter contain data in the Retail_Item business object being processed. See Using the RetailUtility external Java class.

If any of the attributes in the FIELDS subsection are missing from the business object or are present in the business object but missing data, the collaboration object adds their names to a Retail_Item business object attribute named in the configuration property CUST_DATA_MISS_ATTR. This attribute consists of a multiple cardinality array of Retail_Missing_Attributes business objects. If there are any names in this missing attribute child business object array, the ItemValidation collaboration object passes the Retail_Item business object to the ToMissingData port to start a process for obtaining the missing data.

If no file is specified in the REQUIRED_ATTRIBUTE_FILE property, or if no attributes are indicated within the file, all items are accepted for further processing by the collaboration object.

Example

An example file that demonstrates complex filtering and its interpretation follow:
FILTER
notificationDetail.catalogueItemNotification.catalogueItem.tradeItem.   \
tradeItemInformation.informationProviderOfTradeItem.informationProvider.gln
00011112222333
AND
notificationDetail.catalogueItemNotification.catalogueItem.tradeItem.   \
tradeItemUnitDescriptor
CASE,PALLET
FIELDS
notificationDetail.catalogueItemNotification.catalogueItem.tradeItem.   \
tradeItemInformation.tradingPartnerNeutralTradeItemInformation.   \
tradeItemMeasurements.netWeight
notificationDetail.catalogueItemNotification.catalogueItem.tradeItem.   \
tradeItemInformation.tradingPartnerNeutralTradeItemInformation.   \
tradeItemMeasurements.grossWeight  
notificationDetail.catalogueItemNotification.catalogueItem.tradeItem.   \
tradeItemInformation.tradingPartnerNeutralTradeItemInformation.   \
tradeItemMeasurements.height  
notificationDetail.catalogueItemNotification.catalogueItem.tradeItem.   \
tradeItemInformation.tradingPartnerNeutralTradeItemInformation.   \
tradeItemMeasurements.width  
notificationDetail.catalogueItemNotification.catalogueItem.tradeItem.   \
tradeItemInformation.tradingPartnerNeutralTradeItemInformation.   \
tradeItemMeasurements.depth  
FILTER
notificationDetail.catalogueItemNotification.catalogueItem.tradeItem.   \
tradeItemInformation.informationProviderOfTradeItem.informationProvider.gln
00011112222333
AND
notificationDetail.catalogueItemNotification.catalogueItem.tradeItem.   \
tradeItemUnitDescriptor
BASE_UNIT_OR_EACH
FIELDS
notificationDetail.catalogueItemNotification.catalogueItem.tradeItem.   \
tradeItemInformation.tradingPartnerNeutralTradeItemInformation.   \
tradeItemMeasurements.netWeight  
notificationDetail.catalogueItemNotification.catalogueItem.tradeItem.   \
tradeItemInformation.tradingPartnerNeutralTradeItemInformation.   \
tradeItemMeasurements.grossWeight
END

The collaboration object checks if the business object being processed has a gln attribute value of 00011112222333 and a tradeItemUnitDescriptor attribute value of CASE or PALLET. If it doesn’t, the collaboration proceeds to the next FILTER. If it does, the collaboration object then checks if the business object being processed contains the attributes netWeight, grossWeight, height, width, and depth, and that these attributes are not NULL or BLANK. If any of the attributes in the FIELDS subsection are missing from the business object or are present in the business object but missing data, the collaboration object adds their names to a Retail_Item business object attribute named in the configuration property CUST_DATA_MISS_ATTR and handles the business object as described above.

The collaboration object then proceeds to the next FILTER subsection. It checks if the business object has a gln value of 00011112222333 and a tradeItemUnitDescriptor attribute value of BASE_UNIT_OR_EACH. If it does, the collaboration object then checks if the business object being processed contains the attributes netWeight and grossWeight, and that these attributes are not NULL or BLANK. If any of the attributes in the FIELDS subsection are missing from the business object or are present in the business object but missing data, the collaboration object again adds their names to the Retail_Item business object attribute named in the configuration property CUST_DATA_MISS_ATTR and handles the business object as described above.

Parent topic: Validating an item by requiring data for specific attributes