There are functions in other xBase languages that are important, but are not in Harbour. One is Xbase++'s OrdList(). What's the work of OrdList()? Well, it lists the tag names of an index file. For example:
USE MySales.DBF
INDEX ON NAME TAG NAMEX TO SALES.CDX
INDEX ON ACCOUNT TAG ACCTX TO SALES.CDX
...code
Running OrdList() we will get an array of tag names, which using the above example, will result in { NAMEX, ACCTX }.
Here's Xbase++'s documentation/example regarding OrdList():
// OrdList()
// In the example, two index files for a customer file are created
// and then closed. The effect of the function OrdList() is
// shown.
PROCEDURE Main
USE Customer NEW EXCLUSIVE
INDEX ON CUSTNO ;
TAG C_Number ;
TO CustA
INDEX ON Upper(LASTNAME+FIRSTNAME) ;
TAG C_LastName ;
TO CustB
SET INDEX TO CustA, CustB
? OrdList() // Result: {C_NUMBER, C_LASTNAME}
CLOSE Customer
RETURN
FUNCTION MY_ORDLIST()
LOCAL b,a:={},i
SELECT ( Alias() )
b:={OrdName(1),OrdName(2),OrdName(3),OrdName(4),OrdName(5),OrdName(6)}
FOR i:=1 TO LEN( b )
IF b[i] <> NIL
aAdd( a, b[ i ] )
ENDIF
NEXT
RETURN a
May God bless our Harbour Family!
No comments:
Post a Comment