Hi,
I have a problem with building a custom index.
For example: I have a database with 4 character-fields (
Name1, Name2, Name3, Name4, ...) .and. I want to have every name in my
custom index.
The first ORDKEYADD() will work fine, but the following 3 ORDKEYADD()
only will add the Name1 to the index. I will never get Name2, Name3
oder Name4 in my custom index. Whats going wrong??
thanks
Massimo
I have a problem with building a custom index.
For example: I have a database with 4 character-fields (
Name1, Name2, Name3, Name4, ...) .and. I want to have every name in my
custom index.
#include "Fivewin.ch"
FUNCTION MAIN()
    LOCAL  aStr := { { "NAME1", "C", 10, 0 }, ;
             { "NAME2", "C", 10, 0 }, ;
             { "NAME3", "C", 10, 0 }, ;
             { "NAME4", "C", 10, 0 } }
    FERASE( "TEST.DBF" )
    FERASE( "TEST.DBT" )
    FERASE( "TEST.NTX" )
    DBCREATE( "TEST.DBF", aStr )
    USE TEST
    INDEX ON NAME1 TO TEST CUSTOM     // Create a CUSTOM INDEX
    APPEND BLANK
    REPLACE NAME1 WITH "First"
    REPLACE NAME2 WITH "First2"
    REPLACE NAME3 WITH "First3"
    REPLACE NAME4 WITH "First4"
    APPEND BLANK
    REPLACE NAME1 WITH "Second"
    REPLACE NAME2 WITH "Second2"
    REPLACE NAME3 WITH "Second3"
    REPLACE NAME4 WITH "Second4"
    APPEND BLANK
    REPLACE NAME1 WITH "Third"
    REPLACE NAME2 WITH "Third2"
    REPLACE NAME3 WITH "Third3"
    REPLACE NAME4 WITH "Third4"
    USE
    USE TEST INDEX TEST
    GO 2
   Â
    ORDKEYADD()              // Add default KEY field NAME1
    ORDKEYADD( ,, TEST->NAME2 )      // Add KEY for field NAME2
    IF DBSEEK( "Second   " )
        Msgstop( "Second: FIND" )
    ELSE
        Msgstop( "Second: NOT FIND" )
    ENDIF
    IF DBSEEK( "Second2  " )
        Msgstop( "Second2: FIND" )
    ELSE
        Msgstop( "Second2: NOT FIND" )
    ENDIF
    USE
RETURN NILThe first ORDKEYADD() will work fine, but the following 3 ORDKEYADD()
only will add the Name1 to the index. I will never get Name2, Name3
oder Name4 in my custom index. Whats going wrong??
thanks
Massimo