record()

Read(409) Label: record,

Here’s how to use records() function.

 

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.

Parameters:

A

A sequence of sequences

Return value:

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

Parameters:

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 and equal 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 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