table.CHILD_GET Function

Syntax

Table_Alias as C = Child_Get([N child_number])

Arguments

child_number

Optional. Default = All. The Nth table that is linked to the table referenced by <TBL>. If Number is not specified, the method returns a CR-LF delimited string of all child tables linked to <TBL>.

Description

Returns names of children of table [or a single child if number is provided].

Discussion

The <TBL>.CHILD_GET() method is used for determining the structure of a set. Returns the Table_Alias of the N th table (specified by Number ) that is linked to the table referenced by <TBL>. Note : If a table is only opened once in a set, the Table_Alias is the same as the table name.

Example

This session in the Interactive Window shows how a set's structure can be explored.

'open the set
t = set.open("invoice.set")

The next series of commands determine the names of all of the tables in the set, but do not give the structure.

table.current(1).name_get()-> "INVOICE_HEADER"
table.current(2).name_get()-> "CUSTOMER"
table.current(3).name_get()-> "INVOICE_ITEMS"
table.current(4).name_get()-> "PRODUCT"
table.current(5).name_get()-> "VENDOR"
table.current(6).name_get()-> <No data returned>

The next command returns a CR-LF delimited string of all child tables linked to INVOICE_HEADER.

table.current(1).child_get()->
"CUSTOMER
INVOICE_ITEMS
"

The next commands return the names of the child tables linked to INVOICE_HEADER.

table.current(1).child_get(1) -> "CUSTOMER"
table.current(1).child_get(2) -> "INVOICE_ITEMS"
table.current(1).child_get(3) -> ""

Get a pointer to the CUSTOMER table and determine the type of link between CUSTOMER table and its parent.

t2 = table.get("customer")
t2.relation_get()-> "First"

Determine the type of link between INVOICE_ITEMS and its parent.

t3 = table.get("invoice_items")
t3.relation_get()-> "Many,Integrity"

Determine the parent table for INVOICE_ITEMS.

t3.parent_get()-> "INVOICE_HEADER"

See Also