Show/Hide Toolbars

The tc:conditional tag is used to specify a condition that must be met in order for any nested content within the tc:conditional tag, including static text as well as tags, to be included in the generated document. If the condition specified by the tag is met, then anything nested within tc:conditional is generated. If the condition is not met, then the nested content is ignored.

The following points summarize the basics about tc:conditional:

tc:conditional can be nested within almost any other tags. For example, you can nest it within tc:filter or tc:search. For an example of nesting tc:conditional, see Retrieving Specific Type of Related Object with tc:conditional.

You can nest tc:conditional tags within each other, if necessary.

There are two main tag attributes for tc:conditional: compare and test. You must always use either one or the other when you use tc:conditional. However, you cannot use both.

There are two other tag attributes that you can use in combination with compare or test, which are described in the following table.

The following table describes all of the tag attributes that may be used with tc:conditional.

Tag Attributes of tc:conditional

Tag attribute

Attribute value

Description

compare

"Detail[TreePosition]/DetailValue[FieldName],Value"

or

"System[SubObject],Value"

Note: Do not type a space before or after the forward slash (/) or comma.

This tag attribute compares the value from the record with the value specified in the tag. If the value in the record is the same as the value you specify here in the tag, then the condition is met.

Custom fields:

1.Replace TreePosition with the actual category tree position of the custom field.

2.Replace FieldName with the name of the desired custom field.

3.Replace Value with the value that is expected for the condition to be met.

4.For more details, see Using tc:conditional to Compare Custom Field Values.

Sub-objects:

1.Replace SubObject with the name of the sub-object. Do not type List at the end of the name of the sub-object (AddressList, etc.). For example:

Address, Assignee, Email, Fax, InetAddress, Phase, Phone, Relation, Resource, Skill

2.Replace Value with the Name of the sub-object type that you want to look for.

For more details, see Using tc:conditional to Compare Sub-objects.

test

"Detail[UCOD_TREE]"

(testing for a category)

or

"ObjectAttribute"

You can use this tag attribute for checking whether a value exists in system fields only (including categories). The test tag attribute cannot be used for custom fields.

Testing for a category:

Use the test attribute with this syntax to test whether a category exists (has been added) in the current object record. Replace UCOD_TREE with the tree position of the category you want to test.

For example, if you want to test whether the Office (OFFI) category exists for Expense, replace UCOD_TREE with EXPE_OFFI.

Testing for an object attribute value:

Use this tag attribute to test whether a value exists for the object attribute you specify. If it exists, then any content within tc:conditional is generated.

You can use this tag attribute to test:

Whether a value exists for almost any type of object attribute. Types of data you can test include: Date, Text, Number, Object, Memo Text, and so on.

Note: You cannot use this tag attribute to test a boolean value such as a check-box.

Whether there are any instances of a sub-object (for example, whether there is at least one Assignee added to a record)

Whether a category has been added to a record.

Important: When you are using test to see if there is a value and that value is of the data type object (such as a parent record), the tc:conditional tag actually navigates to that object. This means that if you nest any tags within tc:conditional, you must write them relative to the object that you have navigated to.

condition

"greater"

"less"

"equal" (default)

You can use this attribute in conjunction with the compare attribute when setting a tc:conditional tag for a number or date field.

Use greater to indicate that the condition will be met when the number or date value from the system is greater than the value specified in the compare attribute.

Use less to indicate that the condition will be met when the number or date value from the system is less than the value specified in the compare attribute.

The default value for this attribute is equal. When you do not include the condition attribute in the tag, it is assumed that the Document Generator should consider the condition to be met when the value in the system is equal to the value you specify in the compare attribute value.

negate

"yes"

or

"no" (default)

This attribute reverses the logic of tc:conditional. You can use negate with either compare or test.

When you add this attribute to the tag with the attribute value equal to "yes," then the Document Generator will only generate what is nested within tc:conditional when the condition is NOT met.