array()

Read(3173) Label: array,

Here’s how to use array() function.

r.array()

Description:

Get the field values from a record sequentially and return them as a sequence.

Syntax:

r.array(Fi,…)

Note:

The function gets the values of Fi,… fields of the record r in order and returns them as a sequence. Get all the field values when parameter Fi is omitted.

Parameters

r

A record

Fi

Field name

Return value

A sequence

Example

 

A

 

1

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

Return a table sequence:

2

=A1(1).array()

Get the first record from A1 and return its all field values as a sequence:

3

=A1(1).array(STUDENTID,SCORE)

Get the first record from A1 and return values of STUDENTID field and SCORE field as a sequence:

P.array()

Description:

Transform each record of a table sequence/record sequence and return a sequence of sequences.

Syntax:

P.array()

Note:

The function transforms each record of table sequence/record sequence P into a sequence, where each member is also a sequence made up of a record’s field values. The return value type is a sequence of sequences.

Parameter:

P

A table sequence/record sequence

Option:

@b

Discard the first row

Return value:

Sequence of sequences

Example:

 

A

 

1

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

Return a table sequence.

2

=A1.array()

Return a sequence of sequences.

3

=A1.array@b()

Discard the first row as @b option is present: