| # Filter Filtering is choosing specific object instances or component instances, while leaving out others that are irrelevant. A filter is a specification of the conditions that must be met to include a particular object or component in the synchronization scope. For example, only includes orders having status 'released'. Or only include order lines having a planned date filled in. The filter will result in excluding irrelevant business object instances or component instances. A filter is used for performance optimization, because it avoids data being sent that is irrelevant for any client. Filtering is done by attaching an XML text to the synchronization object. This is done in the Synchronization Objects (danch2510m000) session. If a synchronization object is created automatically via the PublishChanges method, the filter text is generated. You can specify a filter by defining a ComparisonExpression or by combining multiple ComparisonExpressions using a LogicalExpression. The filter in the PublishList and PublishChanges request is equal to the filter used for the List and Show methods. Example Assume the following filters must be applied on the components of an Order business object: Order header: (lifecycle = “approved”) or (lifecycle = “toBePlanned”) Order line: deliveryDate < “2004-01-01T00:00:00Z” Then the filter XML will be:
        <LogicalExpression>
            <logicalOperator>and</logicalOperator>
            <LogicalExpression>
                <logicalOperator>or</logicalOperator>
                <ComparisonExpression>
                    <comparisonOperator>eq</comparisonOperator>
                    <attributeName>lifeCycle</attributeName>
                    <instanceValue>approved</instanceValue>
                </ComparisonExpression>
                <ComparisonExpression>
                    <comparisonOperator>eq</comparisonOperator>
                    <attributeName>lifeCycle</attributeName>
                    <instanceValue>toBePlanned</instanceValue>
                </ComparisonExpression>
            </LogicalExpression>
            <ComparisonExpression>
                <comparisonOperator>le</comparisonOperator>
                <attributeName>deliveryDate</attributeName>
                <instanceValue>2004-01-01T00:00:00Z</instanceValue>
            </ComparisonExpression>
        </LogicalExpression>
Important! Filters are defined per object, but they are applied per component, if a component instance exists. You must take this into account, when you define a filter for an aggregated (multi-level) business object. If the attribute values are out of range, only the involved component instance (and its children, if any) is removed. Sibling components instances or parents are not impacted. If the top-level component is out of range, the complete object is out of range. You cannot define filters that aggregate multiple component instances, such as: Only include orders having at least one order line. Only include orders whether the total amount for all order lines exceeds $ 1,000. Within the scope of a logical 'or' expression, you can use attributes from only one component. It is no use to define a filter such as: Order.date is empty or OrderLine.date is empty. No filtering should be done on attributes that get their value from outside the business object (e.g. from a related business object). For other details on filtering, including a procedure on how to define a filter, refer to the Synchronization and Event Publishing Deployment Guide. More information For more information, refer to: Synchronization Server - User Interface Overview Synchronization Server - User Tasks Event Publishing Overview Synchronization and Event Publishing Deployment Guide This deployment guide describes among other things: The specifications for the PublishList, PublishChanges and UnpublishChanges methods. How to use these methods. How to use the Synchronization Server to set up, optimize and manage the event publishing. Important things to take into account when setting up the synchronization or event handling. What to do in case of problems. |