T.append( cs )

Read(40) Label: cursor, pseudo table,

Description:

Append-write records of a cursor to a pseudo table.

Syntax:

T.append(cs)

 

Note:

The function append-writes records of cursor cs to pseudo table T. When source of the pseudo table is multiple composite table files – a sequence of files, append-write the records to the last file.

Parameters:

T

A pseudo table

cs

A cursor

Options:

@i

Append-write immediately at exit of the program or at retrieval while, by default, perform the operation when the number of records reaches to a specified number

@a

MERGE append-write to a patch file, which will be created if there isn’t one

@x

Calculate the zone table expression is at each append when append-writing data in a single cursor to a pseudo table whose source composite table is a multi-zone one because the cursor could correspond to multiple zones

Return value:

A pseudo table

Example:

Ø  Append-write to a pseudo table:

 

A

 

1

=create(file).record([["D:/file/pseudo/Employee1.ctx","D:/file/Employee2.ctx"]])

 

2

=pseudo(A1)

Generate a pseudo table object

3

=create(Dept,AvgSalary).record(["CSD",6400.53])

 

Create a table sequence

4

=A2.append@i(A3.cursor())

Append A3’s cursor record to the pseudo table corresponding to the last composite table file Employee2.ctx

Ø  Merge append-write to a patch file:

 

A

 

1

=create(file).record([["D:/file/pseudo/Employee.ctx"]])

 

2

=pseudo(A1)

Generate a pseudo table object

3

=create(Dept,AvgSalary).record(["CSD",6400.53])

 

Create a table sequence

4

=A2.append@a(A3.cursor())

Employee.ctx.ext With @a option, A3’s cursor record is merge-appended to the composite table file’s patch table, which is auto-generated as follows:

Ø  Append-write a single cursor to a pseudo table:

 

A

 

1

=file("append/apps.ctx":[1,2]).create@yi(#eid, deptid;(deptid%2)+1)

 

2

=to(1,10000).new(~:eid,rand(5)+1:deptid)

Create a table sequence

3

=pseudo(create(file,zone).record(["append/apps.ctx",[1,2]]))

Generate a pseudo table object

4

=A3.append@ix(A2.cursor())

With @x option, append-write A2’s single cursor to two zones of A3’s pseudo table by calculating the zone table expression at each append