ranki()

Read(3039) Label: interative loop, number records,

Description:

Perform an iterative calculation in a loop function to number records according to values of a specific field.

Syntax:

ranki(F;Gi,…)

Note:

The function performs a loop operation to number records from 1 according to values of Gi field. With the same Gi field value, records having same F field value will be given same sequence number; add 1 to the sequence number when F field value changes. When the value of Gi field changes, start a new round of the numbering process. Note that the function does not sort records.

Parameter:

F/ Gi

Field name

Return value:

Integer

Example:

 

A

 

1

=demo.query("select  SUBJECT,STUDENTID,SCORE from SCORES where CLASS='Class one' order by SUBJECT,SCORE desc")

Get score information of students in class one and sort result by SUBJECT in ascending order and by SCORE in descending order.

2

=A1.derive(ranki(SCORE;SUBJECT):RANKING)

Get ranking of scores for each subject – same rank for same score and a tied result does not take up a rank, and store result ranks under RANKING field.