@AllChildren (Formula Language)

Includes all response documents at all levels for parent documents that match selection criteria.

Syntax

SELECT selectionFormula I @AllChildren

Return value

Selects all the documents that match selectionFormula plus their immediate responses.

Usage

@AllChildren can only be used in a view selection or selective replication formula. It must be appended to the end of a selection formula using the Boolean OR operator ("|"). Don't use it within complex expressions in a formula.

@AllChildren allows you to define a view as a set of documents that match a given formula plus the immediate responses to those documents. It also allows you to create a selective replication formula to replicate a set of documents along with the immediate responses.

Selection formulas that use @AllChildren may provide a significant advantage over formulas that use @IsResponseDoc. While @IsResponseDoc returns True for anyresponse document in a database, @AllChildren returns only those responses that are immediate children of matching documents.

Examples

  1. A response hierarchy contains the following documents.

    1.0 What is your favorite color? (Esteban Garcia) 1.1 Blue (Mary Lu) 1.2 Aqua (Jim Thompson) 1.2.1 Why do you like aqua? (Mary Lu) 1.2.2 It reminds me of the ocean (Jim Thompson) 1.3 I like the color orange (Bill Jones)

    The first SELECT statement selects documents 1.2, 1.2.1, and 1.2.2; the second selects documents 1.0, 1.1, 1.2, and 1.3; the third selects documents 1.0, 1.1, 1.2, 1.2.1, 1.2.2, and 1.3; and the fourth selects documents 1.2.1 and 1.3.

    SELECT @Author = "Jim Thompson" | @AllChildren
    SELECT @Author = "Esteban Garcia" | @AllChildren
    SELECT @Author = "Esteban Garcia" | @AllDescendants
    SELECT @Contains( Subject; "like" ) | @AllChildren
  2. You have a Flowers discussion database and you want to add a new view that will show only those documents having to do with orchids. You create an Orchid view, use the View InfoBox to indicate that it should show documents in a response hierarchy, and write the following selection formula for the view:
    SELECT @Contains( Subject; "orchid" ) | @IsResponseDoc

    You get this view:

    Date Topic 04/08/95 The orchid family of flowers (Anne Davis, 2 responses) 04/08/95 Sighting of new variation (Brad Sullivan) 04/08/95 The "ghost" orchid (Rachel Greenbaum) 04/08/95 Local flower shops that carry orchids (Mary Tsen, 1 response) 04/08/95 Try the Blumenhaus (Anne Davis)

    The view, however, is selecting every response document in the entire database, whether or not it has to do with orchids. For example, here's what the view looks like when the response hierarchy is turned off:

    Date Topic 04/08/95 The orchid family of flowers (AnneDavis) 04/08/95 Sighting of new variation (Brad Sullivan) 04/08/95 Special varieties of roses (Michael Bowling) 04/08/95 My roses bloomed late this year (Marcel DuBois) 04/08/95 Local flower shops that carry orchids (Mary Tsen) 04/08/95 Try the Blumenhaus (Anne Davis) 04/08/95 The "ghost" orchid (Rachel Greenbaum)

    The unneeded documents take up valuable space in the view index on the database server. (In addition, if you used this same formula for replication, the unneeded documents would be replicated).

    You use @AllChildren to rewrite the selection formula:

    SELECT @Contains( Subject; "orchid" ) | @AllChildren

    This formula selects and displays only those response documents whose parent contains "orchid" in the Subject field. The view does not contain any hidden response documents.

    Date Topic 04/08/95 The orchid family of flowers (Anne Davis, 2 responses) 04/08/95 Sighting of new variation (Brad Sullivan) 04/08/95 The "ghost" orchid (Rachel Greenbaum) 04/08/95 Local flower shops that carry orchids (Mary Tsen, 1 response) 04/08/95 Try the Blumenhaus (Anne Davis)

  3. Just as you'd hoped, the orchids generate a lively discussion. The Main View of the database, which selects all documents, now looks like this:

    Date Topic 04/08/95 The orchid family of flowers (Anne Davis, 7 responses) 04/08/95 Sighting of new variation (Brad Sullivan, 2 responses) 04/08/95 What color? (Anne Davis) 04/08/95 Please post exact location (Mary Tsen) 04/08/95 The "ghost" orchid (Rachel Greenbaum, 3 responses) 04/08/95 Very difficult to see (Brad Sullivan, 1 response) 04/08/95 Only blooms for an hour or so! (Rachel Greenbaum) 04/08/95 Some sightings reported in Florida (AnneDavis) 04/08/95 Roses beginning to bloom (Peter Donovan, 2 responses) 04/08/95 Special varieties of roses (Michael Bowling) 04/08/95 My roses bloomed late this year (Marcel DuBois) 04/08/95 Local flower shops that carry orchids (Mary Tsen, 1 response) 04/08/95 Try the Blumenhaus (Anne Davis) 04/08/95 Tulip trips to Holland (Mary Tsen)

    The Orchid view you just created, however, does not contain all the documents you want. @AllChildren only selects the immediate children of any parent document(s) that meet the selection criteria:

    Date Topic 04/08/95 The orchid family of flowers (Anne Davis, 4 responses) 04/08/95 Sighting of new variation (Brad Sullivan) 04/08/95 The "ghost" orchid (Rachel Greenbaum, 2 responses) 04/08/95 Very difficult to see (Brad Sullivan) 04/08/95 Some sightings reported in Florida (Anne Davis) 04/08/95 Local flower shops that carry orchids (Mary Tsen, 1 response) 04/08/95 Try the Blumenhaus (Anne Davis)

    In this case, @AllDescendants might provide a better solution. You rewrite the selection formula:

    SELECT @Contains( Subject; "orchid" ) | @AllDescendants

    The Orchid view now contains entire threads of the orchid discussion:

    Date Topic 04/08/95 The orchid family of flowers (Anne Davis, 7 responses) 04/08/95 Sighting of new variation (Brad Sullivan, 2 responses) 04/08/95 What color? (Anne Davis) 04/08/95 Please post exact location (Mary Tsen) 04/08/95 The "ghost" orchid (Rachel Greenbaum, 3 responses) 04/08/95 Very difficult to see (Brad Sullivan, 1 response) 04/08/95 Only blooms for an hour or so! (Rachel Greenbaum) 04/08/95 Some sightings reported in Florida (Anne Davis) 04/08/95 Local flower shops that carry orchids (Mary Tsen, 1 response) 04/08/95 Try the Blumenhaus (Anne Davis)