record()

Read(2539) Label: record,

Here’s how to use records() functions.

A.record()

Description:

Generate a table sequence from a sequence of sequences.

Syntax:

A.record()

Note:

The function generates a table sequence from a sequence of sequences A by making A’s members the records.

Parameter:

A

A sequence of sequences

Return value:

Table sequence

Example:

 

A

 

1

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

 

2

=A1.array()

Return a sequence of sequences.

3

=A2.record()

Generate a table sequence from a sequence of sequences.

A.record(n)

Description:

Generate a table sequence containing a specified number of columns based on a sequence.

Syntax:

A.record(n)

Note:

The function generates a table sequence containing n columns based on sequence A by using the first n members of A as the column names and populating the remaining members to records in turn. By default, it enters nulls to the last record if there is no available data left.

Parameter:

A

A sequence

n

An integer that represents the number of columns in the future table sequence; its value is greater than 0 and less than or equals to A’s length

Return value:

A table sequence

Example:

 

A

 

1

[a,b,1,2,3,4,5,6]

Return a sequence.

2

=A1.record(1)

Generate a one-column table sequence:

3

=A1.record(2)

Generate a two-column table sequence:

4

=A1.record(3)

Generate a three-column table sequence:

T .record ()

Description

Make 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.

Parameter

k

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

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

A

A sequence whose members are reassigned to T’s fields

T

A table sequence

Option

@i

Insert one or more records before the specified record k

Return value

Table sequence

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 is 0.

4

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

Modify the 3rd record when k is 3.

5

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

Insert a record before the 1st record when k is 1.

 

6

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

4, A’s remaining member, is used to append another 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 less than the latter, keep the original values of the remaining fields.

Parameter

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.