Show/Hide Toolbars

The tc:search tag is used to automatically retrieve data from related objects of the current object. When you want to retrieve data from related objects automatically, rather than having the user select the related objects from which data should be retrieved, use tc:search.

For example, if you are creating a document template for Policy and you want to automatically retrieve data from its child Claim records, you would use tc:search to find the desired Claim records and get data from them.

You can retrieve data from the following related objects by using tc:search to navigate to them:

A system object that is directly related to the current object, such as its involved or history.

Note: Documents are not directly related to an object. Therefore, you will not be able to retrieve information or content about a document using tc:search. You will need to use tc:filter instead. For information, see Filters for Non-Related Objects.

A child custom object of the current custom object.

An embedded object of the current custom object.

Child accounts of the current account.

Points To Remember

When using tc:search, you must know the following points:

Unlike tc:filter, when you use tc:search you cannot guarantee that data will be retrieved from only one record. The Document Generator is "searching" for records according to your tag, similar to a search screen in the user interface.

If you use tc:search without any tc:conditional tags, then the data will be retrieved from all instances of a related object and included in the generated document. For example, you may want to include the all of the claims filed against a particular policy.

By nesting the tc:conditional tag within tc:search, you can specify a criterion for the related object records from which to automatically retrieve data.

You can nest tc:search within other tags as needed to navigate to the appropriate object. For example, after navigating to the Contact object through the contact-centric field in a custom object (by using tc:data), you can use tc:search to get that contact's History records.

When NOT to Use tc:search

You must not use tc:search when:

You want the user to select which related object record(s) from which data will be retrieved. Instead, use tc:filter.

You want to retrieve data from a record that is not related to the main object record in any way. Instead, use tc:filter so that the user can select the record.

You want to retrieve data or content from a document record. Instead, use tc:filter to select a non-related record.

You want to retrieve data from sub-objects. Instead, use tc:loop (to automatically identify the sub-objects) or tc:filter (to have the user select the sub-objects).

The following table describes the tag attributes for tc:search.

tc:search Tag Attributes

Tag attribute

Attribute value

Description

link

"ObjectName"

Type the name of the object to which you want the Document Generator to navigate from the current object. The name of the object should be typed as shown:

Appointment

Account

Expense

History

Involved

Task

Project (for child custom objects and embedded objects only)

Note: You must include the qualifier attribute, if you are using tc:search to retrieve child objects.

isForChild

"yes" or "no"

With a value of "yes," this attribute tells the Document Generator that you are retrieving records that belong to one of the following:

A child object of the current object.

An embedded object of the current object.

Incidentally, this means that the object you are navigating to resides in the same (current) table in the database.

By default, "no" is the value for this tag attribute. Make sure to use "no" when you are identifying an object that is not a child of the current object.

qualifier

"Application_ProjObjectDefinition_UniqueCode=UCOD"

This tag attribute is required when you are using tc:search for a child custom object, child account, or an embedded object.

This attribute value identifies the child object using the following values:

1.Path of the object attribute that uniquely identifies the child or embedded object, which is Application_ProjObjectDefinition_UniqueCode.

2.Unique code of the child or embedded object, which can be copied from the Object Definition List in the user interface.

The following example illustrates how tc:search can be used.

Example 1:

<tc:search link="Project" isForChild="yes" qualifier="Application_ProjObjectDefinition_UniqueCode=CLAM">

Claim Information (Child of Policy)

Claim Name: <tc:data select="Name" />

Claim Number: <tc:data select="NumberString" />

</tc:search>

In the example above, tc:search is retrieving only child object records for Claim, since Policy may have other child custom objects besides Claim.

Rather than including data from all related object records that are identified by tc:search, you may want to include only data from those records that meet certain criteria. For example, instead of the names of all the Involved Contacts added to a policy, you may want to include only the names of Involved Contacts that have a certain category, such as Additional Driver.

Example 2:

<tc:data select="Parent">

Parent (Policy) Information

Number: <tc:data select="NumberString" />

Name: <tc:data select="Name" />

Policy Holder: <tc:data select="Contact"><tc:data select="FirstName" /> <tc:data select="Name" /></tc:data>

Additional Drivers: <tc:search link="Involved"><tc:conditional test="Detail[PLIV_ADDR]"><tc:data select="Contact"><tc:data select="FirstName" />

<tc:data select="Name" />

</tc:data></tc:conditional></tc:search>

</tc:data>

In this example, the document template is for the Claim object. The template retrieves data from the Involved of the parent of Claim, which is Policy. First, the template navigates to the parent object. Once the template is pointing at Policy, tc:search is used to identify the Involved records. The tc:conditional tag is then used to retrieve data only from those Involved records with the Additional Driver category (role) added to them.