Create filters

After setting up your content using attribute values to create conditional content, you create filters based on the content to show and hide. For example, you can filter your content to target adminis­trators and authors and exclude end-users by creating the following filter:

(audience=”admin” or audience=”author”)

Create a filter

1)From the Special menu, choose Filter by Attribute.

The Manage Attribute Expressions dialog is displayed.

Manage Attribute Expressions dialog

manage_attrib_exp_dialog_fa.png

Use this dialog to create, edit, delete and apply filters to DITA topics.

2)To create a filter, click New.

The Build Expression dialog is displayed.

Build Expression dialog

bld_exp_dialog_fa.png

3)In the Expression Tag text box, enter a name for the filter.

4)In the Attributes list, choose an attribute to create the filter.

5)In the New Value text box, enter a value for the selected attribute, and then click Add. Repeat this step to add the values that are assigned to the selected attribute in the topic. For details, see Set attribute values for elements.

6)Select the type of rule Equal, Any, or Contains Only and click Add Rule.

Equal:

Filter content that is assigned the values in the Defined Values list for the selected attribute. Evaluates to true if any of the attribute values matches the specified value.

For example, if the selected attribute is audience and the values in the Defined Values list are admin and authors, the rule defined is:

(audience=”admin” or audience=”author”)

Any:

Filter content for any value of the selected attribute. Evaluates to true if any of the attribute values contains the specified value.

For example, if the selected attribute is audience, the rule defined is:

(audience #ANY)

Contains Only:

Filter content with the only attribute values that are defined in the list. Evaluates to true if any of the attribute values only contains all of the specified values.

For example, the following rule filters content that is tagged with the admin and end_user values:

(audience # "admin", "end_user")

This syntax is used as a shortcut to using the OR operator. The above example can also be defined using the OR operator:

(audience = “admin” OR audience=”end_user")

important:   The options described in the above steps are tools that enable you to create rules. However, you can enter the rule in the Expression text box.

Guidelines for creating filter rules

When you create a filter rule, you can choose to use the Add Rule button or you can enter the rule in the Expression box manually. When you choose to save a rule, FrameMaker checks the rule syntax. You cannot save a rule with an incorrect syntax.

Case of attribute name-value

The name of an attribute in a rule is case-sensitive. However, the value of the attribute is case-insensitive.

Correct:

(audience=”ADMIN” OR audience=”end_user”)

The above rule will filter content that is tagged with the attribute value ADMIN, Admin, or admin.

Incorrect:

(audience=”admin” OR Audience=”end_user”)

The attribute name must be defined with the same case as defined in the Attributes pod.

Attribute value

The value of an attribute must be enclosed within double-quote and cannot be empty.

Incorrect:

(audience=””)

Do not use this rule to filter elements having any value for attribute. Instead, use the ANY oper­ator described above.

Use of parenthesis

Each attribute name-value pair must be included within parenthesis.

Include only the same attribute within the same parenthesis.

Correct:

(audience=”admin” OR audience=”end_user” OR audience=”author”)

Incorrect:

(audience=”admin” AND product=”framemaker”)

Only the same attributes can be included in the same parenthesis.

Incorrect:

audience=”admin” OR audience=”end_user” OR audience=”author”

The name-value pairs must be included in parenthesis. Even a single name-value pair must be included in parenthesis.

Use of AND operator

The AND operator cannot be used to filter the same attribute. It can only be used to filter different attributes.

Incorrect:

(audience=”admin” AND audience=”end_user”)

Correct:

(audience=”admin” OR audience=”end_user”) AND (product=”framemaker”)

Use of NOT operator

The NOT operator must be included before the opening parenthesis of an attribute name-value group.

Incorrect:

(audience=”admin”) AND (NOT product=”framemaker”)

Correct:

(audience=”admin”) AND NOT (product=”framemaker”)

Correct:

NOT (product=”framemaker”)

Use of ANY operator

To filter the content tagged with any value of an attribute.

Correct:

(audience #ANY)

The above rule includes all content tagged with the audience attribute irrespective of the value of the attribute.

Correct:

NOT (audience #ANY)

The above rule excludes all content tagged with the audience attribute irrespective of the value of the attribute.


September 30, 2016

Legal Notices | Online Privacy Policy