T.attach(T’,C…)

Read(788) Label: composite table, attached table,

Description:

Add an attached table to the base table of a composite table.

Synatx:

T.attach(T’,C…)

Note:

The function adds attached table T’ to a composite table’s base table T. A composite table can have one or multiple attached tables. The attached table’s dimensions include dimensions of its base table; its column names should be different from the base table’s column names.

Parameter:

T

A base table

T’

An attached table

C

Attached table column, can be omitted; return an attached table named T’ if it is absent; a C preceded by # is a dimension

Return value:

An attached table

Example:

Add an attached table to the base table:

 

A

 

1

=file("D:/ctb.ctx")

 

2

=A1.create(#k1,v1)

Create the composite table’s base table, where k1 is the dimension and v1 is the base table’s column.

3

=A2.attach(table2,#k2,v2)

Add an attached table named table2 to the base table returned by A2; the attached table’s dimension fields are k1 and k2 and its column is v2.

4

=create(k1,v1).record([1,10,2,20,3,30,4,40,10,100])

Create a table sequence.

5

=create(k1,k2,v2).record([1,1,"a",3,1,"c"])

Create a table sequence.

6

=A2.append(A4.cursor())

Append cursor’s records to A2’s base table.

7

=A3.append(A5.cursor())

Append cursor’s records to A3’s attached table.

8

>A2.close()

Close the composite table.