Difference between revisions of "KEYLOOKUP()"

From Lianjapedia
Jump to: navigation, search
(Created page with "==Purpose== Function to perform a cross-table lookup ==Syntax== KEYLOOKUP(<workarea | alias>, <"tagname">, <key expression>, <valueExpr>) ==See Also== LOOKUP(), [[RLOOKU...")
 
Line 10: Line 10:
 
==Description==
 
==Description==
 
The KEYLOOKUP() function looks up the specified index <key expression> in the index <tagname> of the specified <workarea | alias>.  The KEYLOOKUP() function then evaluates the expression <valueExpr>, and returns the value of the <valueExpr> if the <key expression> is found.  The KEYLOOKUP() function returns a null string if the <key expression> is not found.  
 
The KEYLOOKUP() function looks up the specified index <key expression> in the index <tagname> of the specified <workarea | alias>.  The KEYLOOKUP() function then evaluates the expression <valueExpr>, and returns the value of the <valueExpr> if the <key expression> is found.  The KEYLOOKUP() function returns a null string if the <key expression> is not found.  
 +
 +
The current record position in the specified <workarea | alias> cursor is not moved so this function can also safely be used in SQL queries. If the specified <alias> is not already open then Lianja will open the table automatically.
  
 
==Example==
 
==Example==
 
<code lang="recital">
 
<code lang="recital">
 
open database southwind
 
open database southwind
use employees in 0
+
use orders in 0
use order in 0
+
? keylookup("employees","employeeid",orders.employeeid, employees.lastname)
? keylookup(employees,"employeeid",orders.employeeid, employees.lastname)
+
 
</code>
 
</code>
  

Revision as of 12:13, 7 December 2012

Purpose

Function to perform a cross-table lookup

Syntax

KEYLOOKUP(<workarea | alias>, <"tagname">, <key expression>, <valueExpr>)

See Also

LOOKUP(), RLOOKUP(), SEEK(), SET RELATION

Description

The KEYLOOKUP() function looks up the specified index <key expression> in the index <tagname> of the specified <workarea | alias>. The KEYLOOKUP() function then evaluates the expression <valueExpr>, and returns the value of the <valueExpr> if the <key expression> is found. The KEYLOOKUP() function returns a null string if the <key expression> is not found.

The current record position in the specified <workarea | alias> cursor is not moved so this function can also safely be used in SQL queries. If the specified <alias> is not already open then Lianja will open the table automatically.

Example

open database southwind
use orders in 0
? keylookup("employees","employeeid",orders.employeeid, employees.lastname)