Description:
A foreign-key-style join between a cluster cursor and a record sequence.
Syntax:
cs.join(C:.,T:K,x:F,…; …;…)
Note:
The function matches foreign key field C,… of cluster cursor cs with the key of parameter T to find corresponding records in table T. Add an F field represented by x, which is T’s field expression, to cs and return the original cluster cursor. K can be omitted or represented by #. When omitted, K is T’s key; when written as #, K is represented by a sequence number. It supports the multicursor.
Options:
@c |
With a distributed cluster table, the operation won’t involve a cross-node reference but it assumes that the referenced records are local |
Parameters:
cs |
A cursor/multicursor/cluster cursor |
C |
cs’s foreign key; separate multiple fields in a composite key with the colon |
T |
A cluster memory table |
K |
T’s key |
x |
T’s field expression |
F |
Name of T’s field expression |
Return value:
The original cursor
Example:
|
A |
|
1 |
[192.168.18.143:8281] |
|
2 |
=file("emp_1.ctx":[2], A1) |
|
3 |
=A2.open() |
|
4 |
=A3.cursor() |
A cluster cursor |
5 |
[192.168.0.110:8281] |
|
6 |
=file("PERFORMANCE.ctx":[1],A5) |
|
7 |
=A6. open () |
|
8 |
=A7.cursor() |
|
9 |
=A8.memory() |
A cluster memory table |
10 |
=A4.join(EID,A9:EMPLOYEEID, BONUS*12:total) |
Match EID field of A4’s cluser cursor with the key field EMPLOYEEID of A9’s cluster memory table, make the value of calculating expression BONUS*12 over the memory table total field and join it up with the cluster cursor, and return the cluster cursor |
11 |
=A10.fetch() |
Fetch data from A10’s cursor |