record()

Read(295) Label: record,

Here’s how to use records() function.

T .record()

Description

Make the members of a sequence the new field values of records of a table sequence.

Syntax

T.record(A,k)

Note

From the specified record k, reassign values to the fields of table sequence T’s records in sequence with members of sequence A. The number of to-be-reassigned records is determined by the number of both A’s members and T’s fields. If the number of A’s members is indivisible by the number of T’s fields, go on to reassign A’s remaining members to the fields of the next record.

Parameters

k

An integer; this means the records will be modified from the kth one

By default or when k ==0, append records to table sequence T

A

A sequence whose members are used to reassign values to T’s fields

T

A table sequence

Options

@i

Insert one or more records before the specified record k

@n

Return the newly-inserted or -modified records or record sequences

Return value

  The modified table sequence T

Example

 

A

 

1

=create(StuID,StuName,English)

2

=A1.record([1,"Lucy",98,2,"Petter",87])

Append records to the table sequence by default

 

3

=A1.record([10," Claire",88],0)

 Append records to the table sequence when k=0

4

=A1.record([10,"Gail",88],3)

 Modify the 3rd record when k=3

5

=A1.record@i([11," Jamie",90],1)

Insert a record before the 1st record when k=1 and @i is used

 
 

6

=A1.record([3," Lily",67,4])

4, A’s remaining member, is used to append another record

 

7

=A1.record@n([15,"Gail",88],3)

Return the newly-inserted record

 

r.record()

Description

Modify field values of a record with members of a sequence.

Syntax

r.record(A)

Note

The function uses members of sequence A to modify the fields of record r. If the number of A’s members is more than that of r’s fields, discard the surplus members; if the former is lessr than the latter, keep the orginal values of the remaining fields.

Parameters

r

A record

A

A sequence

Return value:

A record

 Example

 

A

 

1

=demo.query("select * from SCORES")

The original table sequence in A1

2

=A1(1)

 

3

[Class four,1,English,100]

 

4

=A2.record(A3)

A1’s table sequence after the first record is modified