ch.sortx()

Read(912) Label: channel, records, sort,

Description:

Sort records in a channel.

Syntax:

ch.sortx(x,…)

Note:

The function sorts records in channel ch by expression x,… and returns the sorted records as a channel. This is a function for directly getting a result set from the channel.

Parameter:

ch

Channel

x

An expression, according to which the records in a given channel is sorted in ascending order

Return value:

Channel

Example:

 

A

 

1

=demo.cursor("select EID,NAME,DEPT,SALARY from EMPLOYEE order by EID desc")

Return a cursor with desired records.

2

=channel()

Create a channel.

3

=A2.sortx(SALARY,EID)

Sort records in the channel by SALARY field and EID field.

4

=A1.push(A2)

Push data in A1’s cursor into the channel

5

=A1.fetch()

Fetch data from A1’s cursor.

6

=A2.result()

Return result as a cursor.

7

=A6.fetch()