#@

Read(324) Label: count item,

Description:

The COUNT item in a cell expression.

Note:

The statement represents the COUNT item in a cell expression. The initial value is 0 and add 1 after each round of execution.

 

It can be used to invoke ordinal number of the record in a cursor.

Return value:

Integer

Example:

As the COUNT item in a cell expression:

 

A

B

 

1

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

=[]

 

2

for A1;SALARY

 

 

3

 

>B1.insert(0,A2)

Loop through the cursor and retrieve a batch of records having same SALARY value each time to insert B1; below is the result content of B1:

4

 

=#@

According to B1’s result set, SALARY values can be divided into four groups, which means the number of loop rounds is 4; so, the result returned is 4.

When used to invoke ordinal number of the record in a cursor:

 

A

 

1

=connect("demo").cursor("select EID,NAME,DEPT,HIREDATE,SALARY from employee").sortx(HIREDATE)

Return data in employee table as a cursor and sort the cursor by HIREDATE.

2

=A1.group@i(#@%10==1)

Group A1’s cursor every 10 records.

3

=A2.fetch()

Fetch data from the cursor: