Page 1 of 1
Index file question
Posted: Mon Dec 17, 2012 8:53 am
by Otto
To all,
Is it possible to add records to an index file manually.
For an example I want to browse a file and would like to show 1 record more times.
Database
1 test
2 test 2
3 test 3
4 test 4
Index file
1
1
4
2
Browse
1 test
1 test
4 test 4
2 test 2
Best regards,
Otto
Re: Index file question
Posted: Mon Dec 17, 2012 10:48 am
by Patrizio
Code: Select all
// The example shows two approaches for building a custom index.
// In the first approach, the controlling index is a regular index
// which allows for relative database navigation. The second approach
// uses the custome index as controlling index and requires absolute
// database navigation. The first five logical records and physical records
// are added to the custome index.
REQUEST Dbfcdx
PROCEDURE Main
USE Customer VIA "DBFCDX"
INDEX ON Upper(LastName+FirstName) TAG NAME TO Cust01
INDEX ON Upper(LastName+FirstName) TAG NAMESET TO Cust01t CUSTOM
// relative navigation with non-custom index
OrdSetFocus( "NAME" )
GO TOP
FOR i:=1 TO 5
OrdKeyAdd( "NAMESET" )
SKIP
NEXT
GO TOP
Browse()
// absolute navigation with custom index
OrdSetFocus( "NAMESET" )
FOR i:=1 TO 5
DbGoto( i )
OrdKeyAdd( "NAMESET" )
NEXT
GO TOP
Browse()
USE
RETURN
Re: Index file question
Posted: Mon Dec 17, 2012 10:59 am
by Otto
Patrizio,
thank you for your sample.
I will experiment this evening with your code.
Best regards from Alter Pusteria,
Otto