• esProc
Tutorial
Function Reference
Code Reference
User Reference
External Library Guide
Data File Tool Manual
DQL Tutorial
Cluster Server Manager Manual
SPL WIN Manual
• YModel
User Reference
JSON-style Parameter Guide
• ReportLite
User Reference
• Official Website

prior()

Read（1915） Label: foreign key, query recursively,

Here’s how to use prior() function.

r. prior()

Description

Among the records, query fields referred by the foreign key recursively.

Syntax:

r.prior(F,r',n)

Note

The function recursively queries field F referred by the foreign key, like [r,r. F, r. F. F,…] in record r. The query will not stop until the value of field F is equal to r'. When r is equal to r' , then return [].The default value of r' is NULL. The recursive query will be performed through all the records to the end. If the specified record r' does not exist, then return NULL. n is the maximum recursion depth, its value is 1,000 by default.

Parameter

 r Records F Field name r' A record n A Number

Return value

Sequence

Example

 A 1 =file("D://emp.txt").import@t().keys(empid) 2 >A1.switch(mgrid,A1:empid) 3 =A1.select@1(name=="Kitty").prior(mgrid) Based on mgrid field referred by the foreign key, select all records of people who are superior to Kitty. 4 =A1.select@1(name=="Kitty").prior(mgrid,A1.select@1(name=="Tiger"),5) Judge if Tiger is superior to Kitty and list all records of people superior to Barnes but inferior to Tiger.