Very strange indexing problem

User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Very strange indexing problem

Post by Antonio Linares »

Done :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Very strange indexing problem

Post by Antonio Linares »

Michel,

I need your help to build a PRG without FWH that reproduces the error.

I just sent you an email, please have a look at it :-)

thanks,
regards, saludos

Antonio Linares
www.fivetechsoft.com
Jose Dolar
Posts: 52
Joined: Thu Mar 22, 2012 5:43 pm
Location: USA

Re: Very strange indexing problem

Post by Jose Dolar »

Hi All,

Any update?

Thank you,

Jose
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Very strange indexing problem

Post by Antonio Linares »

Jose,

Michel solved it. He modified some lines in his code and the problem went away.

His code is complex so I don't know for sure what made the trick, but it worked :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
driessen
Posts: 1239
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Very strange indexing problem

Post by driessen »

Antonio,

Thanks again for all your efforts in helping me.

I let my application do its task in another way after which the problem didn't occur anymore.
I really don't know what went wrong. But at the moment, my problem is solved. And that is the main thing.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
Jose Dolar
Posts: 52
Joined: Thu Mar 22, 2012 5:43 pm
Location: USA

Re: Very strange indexing problem

Post by Jose Dolar »

Thank you guys for the quick reply.

How about Tim's observation on his app?

Hello Tim. Kindly comment. Thank you very much.

I am a bit worried because we have scheduled testing of our app built with Harbour 3.2 and FWH 14.11 early next year.

Regards to all,

Jose
joseluispalma
Posts: 93
Joined: Mon Apr 30, 2012 9:10 am

Re: Very strange indexing problem

Post by joseluispalma »

Hello, can you please share how you solved it please?.

Thank you.
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Very strange indexing problem

Post by Antonio Linares »

Michel,

Could you compare your old code and the new one, using UltraCompare or any other similar tool, and post here the differences ?

many thanks :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
driessen
Posts: 1239
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Very strange indexing problem

Post by driessen »

Guys,

I put here the old code and the changed code. It won't be easy to compare them.

The old code :

Code: Select all

FOR Agi=1 TO AgTel

    IF actie = "Insert"
       UnAGCODE := SPACE(10)
       FOR CreTel = 1 TO 100
           CreRecA1 := 0
           CreRecA1 := AddRecJuda()
           IF CreRecA1 <> 0 .AND. EMPTY(AG->AGINGDAT) .AND. EMPTY(AG->AGINGEVER)
              CreTel := 100
           ENDIF
       NEXT
       IF CreRecA1 <> 0 .AND. CreRecA1 = AG->(RECCOUNT())
          UnAGCODE := LeesAgUniek()
          GOTO CreRecA1
          OldPar[3] := RECNO()
       ELSE
          dRet := .F.
       ENDIF
    ENDIF

    BT_ET_Contr("cAGBTIJD","cAGETIJD")

    IF !cAGAGRAP
       IF !EMPTY(cAGBTIJD) .AND. ALLTRIM(cAGBTIJD) <> ":" .AND. !EMPTY(cAGRTIJD) .AND. ALLTRIM(cAGRTIJD) <> "00:00" .AND. ALLTRIM(cAGRTIJD) <> ":"
          UurVersch("cAGBTIJD","dAGBTIJD","cAGRTIJD","cNIETS1",.F.)
       ELSE
          dAGBTIJD := cAGBTIJD
       ENDIF
       IF !EMPTY(cAGETIJD) .AND. ALLTRIM(cAGETIJD) <> ":" .AND. !EMPTY(cAGRTIJD) .AND. ALLTRIM(cAGRTIJD) <> "00:00" .AND. ALLTRIM(cAGRTIJD) <> ":"
          UurVersch("cAGETIJD","dAGETIJD","cAGRTIJD","cNIETS1",.T.)
       ELSE
          dAGETIJD := cAGETIJD
       ENDIF
    ENDIF

    IF actie = "Update" .AND. CTOD(cAGDATUM) <> CTOD(pAGDATUM) .AND. MsgNoYes("U wijzigde de datum van dit agendapunt !!!" + CHR(13) + CHR(13) + "Moet dit agendapunt op de originele datum ook bewaard blijven ?","Kies "+CHR(34)+"JA"+CHR(34)+" of "+CHR(34)+"NEE"+CHR(34))
       UnAGCODE := SPACE(10)
       FOR CreTel = 1 TO 100
           CreRecA1 := 0
           CreRecA1 := AddRecJuda()
           IF CreRecA1 <> 0 .AND. EMPTY(AG->AGINGDAT) .AND. EMPTY(AG->AGINGEVER)
              CreTel := 100
           ENDIF
       NEXT
       IF CreRecA1 <> 0 .AND. CreRecA1 = AG->(RECCOUNT())
          UnAGCODE := LeesAgUniek()
          GOTO CreRecA1
          OldPar[3] := RECNO()
          oOrig     := .T.
       ELSE
          dRet := .F.
       ENDIF
    ENDIF

    SELECT AG
    IF dRet .AND. RecLockJuda(2,PROCNAME(),PROCLINE(),2,TaalCode)
       IF VAL(UnAGCODE) <> 0
          AG->AGCODE := UnAGCODE
       ENDIF
       AG->AGUSER    := &("cAGUSER"   + STR(Agi,1,0))
       AG->AGUSERN   := &("cAGUSERN"  + STR(Agi,1,0))
       AG->AGUSERNS  := &("cAGUSERNS" + STR(Agi,1,0))
       AG->AGDOSKOP  := cAGDOSKOP

       NaamSamen("AG->AGDOSSIER",cAGDOS1,cAGDOS2,cAGSDOS)

       SELECT DOSS
       SET ORDER TO 5
       SEEK(UPPER(ALLTRIM(AG->AGDOSSIER)))
       IF FOUND()
          cBKBEHE    := DOSS->DBEHENR
       ENDIF
       SELECT AG
       AG->AGBEHEER  := cBKBEHE
       cBKBEHE       := SPACE(7)

       AG->AGDATUM   := CTOD(cAGDATUM)
       AG->AGGROEP   := cAGGROEP
       AG->AGSRTNR   := cAGSRTNR
       AG->AGSRTNRN  := cAGSRTNRN
       AG->AGVERGNR  := cAGVERGNR
       AG->AGVERGNRN := cAGVERGNRN

       IF !cAGAGRAP
          IF !EMPTY(cAGBTIJD) .AND. ALLTRIM(cAGBTIJD) <> ":" .AND. !EMPTY(cAGRTIJD) .AND. ALLTRIM(cAGRTIJD) <> "00:00" .AND. ALLTRIM(cAGRTIJD) <> ":"
             UurVersch("cAGBTIJD","dAGBTIJD","cAGRTIJD","cNIETS1",.F.)
          ELSE
             dAGBTIJD := cAGBTIJD
          ENDIF
          IF !EMPTY(cAGETIJD) .AND. ALLTRIM(cAGETIJD) <> ":" .AND. !EMPTY(cAGRTIJD) .AND. ALLTRIM(cAGRTIJD) <> "00:00" .AND. ALLTRIM(cAGRTIJD) <> ":"
             UurVersch("cAGETIJD","dAGETIJD","cAGRTIJD","cNIETS1",.T.)
          ELSE
             dAGETIJD := cAGETIJD
          ENDIF
       ELSE
          dAGBTIJD   := "99:99"
          dAGETIJD   := "99:99"
       ENDIF

       AG->AGBTIJD   := IF(!cAGAGRAP,IF(EMPTY(cAGBTIJD) .OR. ALLTRIM(cAGBTIJD)="00:00" .OR. ALLTRIM(cAGBTIJD)=":",PAR->STBTIJD,cAGBTIJD),"99:99")
       AG->AGETIJD   := IF(!cAGAGRAP,IF(EMPTY(cAGETIJD) .OR. ALLTRIM(cAGETIJD)="00:00" .OR. ALLTRIM(cAGETIJD)=":",PAR->STETIJD,cAGETIJD),"99:99")
       AG->AGRTIJD   := IF(EMPTY(cAGRTIJD) .OR. ALLTRIM(cAGRTIJD)="00:00" .OR. ALLTRIM(cAGRTIJD)=":","00:00",cAGRTIJD)

       IF !cAGAGRAP
          IF EMPTY(cAGRTIJD) .OR. ALLTRIM(cAGRTIJD)=":" .OR. ALLTRIM(cAGRTIJD) = "00:00" .OR. ALLTRIM(cAGRTIJD) = "99:99"
             AG->AGERTIJD := 10000 + (Uur60To100(cAGETIJD) * 100)
          ELSE
             UurVersch("AG->AGETIJD","cAGERTIJD","AG->AGRTIJD",,.T.,.F.)
             AG->AGERTIJD := 10000 + (Uur60To100(cAGERTIJD) * 100)
          ENDIF
       ELSE
          AG->AGERTIJD := 0
       ENDIF

       AG->AGBCODE   := UPPER(&("cAGUSER"+STR(Agi,1,0))+DTOS(CTOD(cAGDATUM))+LEFT(dAGBTIJD,2)+RIGHT(dAGBTIJD,2))
       AG->AGECODE   := UPPER(&("cAGUSER"+STR(Agi,1,0))+DTOS(CTOD(cAGDATUM))+LEFT(dAGETIJD,2)+RIGHT(dAGETIJD,2))
       AG->AGBCODC   := RIGHT(AG->AGBCODE,12)
       AG->AGECODC   := RIGHT(AG->AGECODE,12)

       AG->AGOMSCH   := cAGOMSCH
       AG->AGALARM   := IF(!cAGAFGESL,cAGALARM,.F.)
       IF cAGALARM .AND. CTOD(cAGDATUM) <> CTOD(oAGDATUM)
          IF oAANTDAG <> 0 .AND. MsgYesNo("Mag de alarmdatum in verhouding aangepast worden"+CHR(13)+"aan de ingegeven datum van het alarmpunt ?","Kies "+CHR(34)+"JA"+CHR(34)+" of "+CHR(34)+"NEE"+CHR(34))
             AG->AGALDAG := CTOD(cAGDATUM) - oAANTDAG
          ELSEIF MsgYesNo("Mag de alarmdatum aan de datum"+CHR(13)+"van het agendapunt aangepast worden ?","Kies "+CHR(34)+"JA"+CHR(34)+" of "+CHR(34)+"NEE"+CHR(34))
             AG->AGALDAG := CTOD(cAGDATUM)
          ENDIF
       ELSE
          AG->AGALDAG := IF(!cAGAFGESL .AND. cAGALARM,CTOD(cAGALDAG),CTOD("  /  /    "))
       ENDIF
       AG->AGALUUR   := IF(!cAGAFGESL .AND. cAGALARM .AND. !EMPTY(cAGALUUR) .AND. ALLTRIM(cAGALUUR) <> ":",cAGALUUR,"99:99")
       AG->AGALCODE  := IF(!cAGAFGESL .AND. cAGALARM,UPPER(&("cAGUSER"+STR(Agi,1,0))+DTOS(AG->AGALDAG)+IF(AG->AGALUUR<>"99:99",LEFT(AG->AGALUUR,2)+RIGHT(AG->AGALUUR,2),"0000")),SPACE(19))
       AG->AGVOORL   := IF(!cAGAGRAP,cAGVOORL,.F.)
       AG->AGPRNR    := cAGPRNR
       AG->AGPRNRN   := cAGPRNRN
       AG->AGANNR    := cAGANNR
       AG->AGANNRN   := cAGANNRN
       AG->AGMETWIE  := cAGMETWIE
       AG->AGAGDOS   := IF(!cAGAGRAP,cAGAGDOS,.F.)
       AG->AGAGKAN   := IF(!cAGAGRAP,cAGAGKAN,.F.)
       AG->AGAGPRO   := IF(!cAGAGRAP,cAGAGPRO,.F.)
       AG->AGAGPER   := IF(!cAGAGRAP,cAGAGPER,.F.)
       AG->AGAGRAP   := cAGAGRAP
       AG->AGHOOFD   := IF(!cAGAGRAP,cAGHOOFD,.F.)
       AG->AGAFGESL  := IF(oOrig,.F.,cAGAFGESL)
       AG->AGINGDAT  := CTOD(cAGINGDAT)
       AG->AGINGEVER := cAGINGEVER
       AG->AGCHADAT  := DATE()
       AG->AGCHANGER := US->UAFKORT
       AG->AGOUTLID  := cAGOUTLID
       AG->AGOUTLDAT := cAGOUTLDAT
       AG->AGEXPORT  := cAGEXPORT
       AG->AGKM      := cAGKM
       AG->AGMEMO    := cAGMEMO
    ENDIF
    RecUnLockJuda(2,PROCNAME(),PROCLINE())

    EDossier := AG->AGDOSSIER

NEXT
The changed code :

Code: Select all

FOR Agi=1 TO AgTel

    IF actie = "Insert"
       UnAGCODE := SPACE(10)
       FOR CreTel = 1 TO 100
           CreRecA1 := 0
           CreRecA1 := AddRecJuda()
           IF CreRecA1 <> 0 .AND. EMPTY(AG->AGINGDAT) .AND. EMPTY(AG->AGINGEVER)
              CreTel := 100
           ENDIF
       NEXT
       IF CreRecA1 <> 0 .AND. CreRecA1 = AG->(RECCOUNT())
          UnAGCODE := LeesAgUniek()
          GOTO CreRecA1
          OldPar[3] := RECNO()
       ELSE
          dRet := .F.
       ENDIF
    ENDIF

    BT_ET_Contr("cAGBTIJD","cAGETIJD")

    IF !cAGAGRAP
       IF !EMPTY(cAGBTIJD) .AND. ALLTRIM(cAGBTIJD) <> ":" .AND. !EMPTY(cAGRTIJD) .AND. ALLTRIM(cAGRTIJD) <> "00:00" .AND. ALLTRIM(cAGRTIJD) <> ":"
          UurVersch("cAGBTIJD","dAGBTIJD","cAGRTIJD","cNIETS1",.F.)
       ELSE
          dAGBTIJD := cAGBTIJD
       ENDIF
       IF !EMPTY(cAGETIJD) .AND. ALLTRIM(cAGETIJD) <> ":" .AND. !EMPTY(cAGRTIJD) .AND. ALLTRIM(cAGRTIJD) <> "00:00" .AND. ALLTRIM(cAGRTIJD) <> ":"
          UurVersch("cAGETIJD","dAGETIJD","cAGRTIJD","cNIETS1",.T.)
       ELSE
          dAGETIJD := cAGETIJD
       ENDIF
    ENDIF

    cAGRECORD := OldPar[3]
    cAGDELETE := .F.

    IF actie = "Update" .AND. CTOD(cAGDATUM) <> CTOD(pAGDATUM)
       UnAGCODE  := SPACE(10)
       FOR CreTel = 1 TO 100
           CreRecA1 := 0
           CreRecA1 := AddRecJuda()
           IF CreRecA1 <> 0 .AND. EMPTY(AG->AGINGDAT) .AND. EMPTY(AG->AGINGEVER)
              CreTel := 100
           ENDIF
       NEXT
       IF CreRecA1 <> 0 .AND. CreRecA1 = AG->(RECCOUNT())
          UnAGCODE := LeesAgUniek()
          GOTO CreRecA1
          IF !MsgNoYes("U wijzigde de datum van dit agendapunt !!!" + CHR(13) + CHR(13) + "Moet dit agendapunt op de originele datum ook bewaard blijven ?","Kies "+CHR(34)+"JA"+CHR(34)+" of "+CHR(34)+"NEE"+CHR(34))
             cAGDELETE := .T.
          ENDIF
          OldPar[3] := RECNO()
          oOrig     := .T.
       ELSE
          dRet := .F.
       ENDIF
    ENDIF

    IF dRet .AND. RecLockJuda(2,PROCNAME(),PROCLINE(),2,TaalCode)
       IF VAL(UnAGCODE) <> 0
          AG->AGCODE := UnAGCODE
       ENDIF
       AG->AGUSER    := &("cAGUSER"   + STR(Agi,1,0))
       AG->AGUSERN   := &("cAGUSERN"  + STR(Agi,1,0))
       AG->AGUSERNS  := &("cAGUSERNS" + STR(Agi,1,0))
       AG->AGDOSKOP  := cAGDOSKOP

       NaamSamen("AG->AGDOSSIER",cAGDOS1,cAGDOS2,cAGSDOS)

       SELECT DOSS
       SET ORDER TO 5
       SEEK(UPPER(ALLTRIM(AG->AGDOSSIER)))
       IF FOUND()
          cBKBEHE    := DOSS->DBEHENR
       ENDIF
       SELECT AG
       AG->AGBEHEER  := cBKBEHE
       cBKBEHE       := SPACE(7)

       AG->AGDATUM   := CTOD(cAGDATUM)
       AG->AGGROEP   := cAGGROEP
       AG->AGSRTNR   := cAGSRTNR
       AG->AGSRTNRN  := cAGSRTNRN
       AG->AGVERGNR  := cAGVERGNR
       AG->AGVERGNRN := cAGVERGNRN

       IF !cAGAGRAP
          IF !EMPTY(cAGBTIJD) .AND. ALLTRIM(cAGBTIJD) <> ":" .AND. !EMPTY(cAGRTIJD) .AND. ALLTRIM(cAGRTIJD) <> "00:00" .AND. ALLTRIM(cAGRTIJD) <> ":"
             UurVersch("cAGBTIJD","dAGBTIJD","cAGRTIJD","cNIETS1",.F.)
          ELSE
             dAGBTIJD := cAGBTIJD
          ENDIF
          IF !EMPTY(cAGETIJD) .AND. ALLTRIM(cAGETIJD) <> ":" .AND. !EMPTY(cAGRTIJD) .AND. ALLTRIM(cAGRTIJD) <> "00:00" .AND. ALLTRIM(cAGRTIJD) <> ":"
             UurVersch("cAGETIJD","dAGETIJD","cAGRTIJD","cNIETS1",.T.)
          ELSE
             dAGETIJD := cAGETIJD
          ENDIF
       ELSE
          dAGBTIJD   := "99:99"
          dAGETIJD   := "99:99"
       ENDIF

       AG->AGBTIJD   := IF(!cAGAGRAP,IF(EMPTY(cAGBTIJD) .OR. ALLTRIM(cAGBTIJD)="00:00" .OR. ALLTRIM(cAGBTIJD)=":",PAR->STBTIJD,cAGBTIJD),"99:99")
       AG->AGETIJD   := IF(!cAGAGRAP,IF(EMPTY(cAGETIJD) .OR. ALLTRIM(cAGETIJD)="00:00" .OR. ALLTRIM(cAGETIJD)=":",PAR->STETIJD,cAGETIJD),"99:99")
       AG->AGRTIJD   := IF(EMPTY(cAGRTIJD) .OR. ALLTRIM(cAGRTIJD)="00:00" .OR. ALLTRIM(cAGRTIJD)=":","00:00",cAGRTIJD)

       IF !cAGAGRAP
          IF EMPTY(cAGRTIJD) .OR. ALLTRIM(cAGRTIJD)=":" .OR. ALLTRIM(cAGRTIJD) = "00:00" .OR. ALLTRIM(cAGRTIJD) = "99:99"
             AG->AGERTIJD := 10000 + (Uur60To100(cAGETIJD) * 100)
          ELSE
             UurVersch("AG->AGETIJD","cAGERTIJD","AG->AGRTIJD",,.T.,.F.)
             AG->AGERTIJD := 10000 + (Uur60To100(cAGERTIJD) * 100)
          ENDIF
       ELSE
          AG->AGERTIJD := 0
       ENDIF

       AG->AGBCODE   := UPPER(&("cAGUSER"+STR(Agi,1,0))+DTOS(CTOD(cAGDATUM))+LEFT(dAGBTIJD,2)+RIGHT(dAGBTIJD,2))
       AG->AGECODE   := UPPER(&("cAGUSER"+STR(Agi,1,0))+DTOS(CTOD(cAGDATUM))+LEFT(dAGETIJD,2)+RIGHT(dAGETIJD,2))
       AG->AGBCODC   := RIGHT(AG->AGBCODE,12)
       AG->AGECODC   := RIGHT(AG->AGECODE,12)

       AG->AGOMSCH   := cAGOMSCH
       AG->AGALARM   := IF(!cAGAFGESL,cAGALARM,.F.)
       IF cAGALARM .AND. CTOD(cAGDATUM) <> CTOD(oAGDATUM)
          IF oAANTDAG <> 0 .AND. MsgYesNo("Mag de alarmdatum in verhouding aangepast worden"+CHR(13)+"aan de ingegeven datum van het alarmpunt ?","Kies "+CHR(34)+"JA"+CHR(34)+" of "+CHR(34)+"NEE"+CHR(34))
             AG->AGALDAG := CTOD(cAGDATUM) - oAANTDAG
          ELSEIF MsgYesNo("Mag de alarmdatum aan de datum"+CHR(13)+"van het agendapunt aangepast worden ?","Kies "+CHR(34)+"JA"+CHR(34)+" of "+CHR(34)+"NEE"+CHR(34))
             AG->AGALDAG := CTOD(cAGDATUM)
          ENDIF
       ELSE
          AG->AGALDAG := IF(!cAGAFGESL .AND. cAGALARM,CTOD(cAGALDAG),CTOD("  /  /    "))
       ENDIF
       AG->AGALUUR   := IF(!cAGAFGESL .AND. cAGALARM .AND. !EMPTY(cAGALUUR) .AND. ALLTRIM(cAGALUUR) <> ":",cAGALUUR,"99:99")
       AG->AGALCODE  := IF(!cAGAFGESL .AND. cAGALARM,UPPER(&("cAGUSER"+STR(Agi,1,0))+DTOS(AG->AGALDAG)+IF(AG->AGALUUR<>"99:99",LEFT(AG->AGALUUR,2)+RIGHT(AG->AGALUUR,2),"0000")),SPACE(19))
       AG->AGVOORL   := IF(!cAGAGRAP,cAGVOORL,.F.)
       AG->AGPRNR    := cAGPRNR
       AG->AGPRNRN   := cAGPRNRN
       AG->AGANNR    := cAGANNR
       AG->AGANNRN   := cAGANNRN
       AG->AGMETWIE  := cAGMETWIE
       AG->AGAGDOS   := IF(!cAGAGRAP,cAGAGDOS,.F.)
       AG->AGAGKAN   := IF(!cAGAGRAP,cAGAGKAN,.F.)
       AG->AGAGPRO   := IF(!cAGAGRAP,cAGAGPRO,.F.)
       AG->AGAGPER   := IF(!cAGAGRAP,cAGAGPER,.F.)
       AG->AGAGRAP   := cAGAGRAP
       AG->AGHOOFD   := IF(!cAGAGRAP,cAGHOOFD,.F.)
       AG->AGAFGESL  := IF(oOrig,.F.,cAGAFGESL)
       AG->AGINGDAT  := CTOD(cAGINGDAT)
       AG->AGINGEVER := cAGINGEVER
       AG->AGCHADAT  := DATE()
       AG->AGCHANGER := US->UAFKORT
       AG->AGOUTLID  := cAGOUTLID
       AG->AGOUTLDAT := cAGOUTLDAT
       AG->AGEXPORT  := cAGEXPORT
       AG->AGKM      := cAGKM
       AG->AGMEMO    := cAGMEMO
    ENDIF
    RecUnLockJuda(2,PROCNAME(),PROCLINE())

    EDossier := AG->AGDOSSIER

    IF cAGDELETE .AND. cAGRECORD <> 0
       GOTO cAGRECORD
       IF RecLockJuda(2,PROCNAME(),PROCLINE(),2,TaalCode)
          DELETE
       ENDIF
       RecUnLockJuda(2,PROCNAME(),PROCLINE())
       cAGRECORD := 0
       cAGDELETE := .F.
       GOTO OldPar[3]
    ENDIF

NEXT
I hope it can be a help.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Very strange indexing problem

Post by Antonio Linares »

Michel,

Thanks! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
TimStone
Posts: 2536
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Contact:

Re: Very strange indexing problem

Post by TimStone »

I mentioned that a few of my clients had some problems but I do not have anything further.

I am doing a major revision / optimization to my application so I won't see if the problem still exists until early 2015. It may be cleared up as I check all of the code very carefully to be sure all files properly close at the correct time.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: Very strange indexing problem

Post by James Bott »

Michel,

I notice that your code is rather hard to read. I hope you don't mind me making a few suggestions.

One issue is that all your fieldnames begin with the same first two characters (AG), which I assume is your code for the file from which they belong. Unfortunately, this uses up 2 of the 8 characters you have for fieldnames and all the fieldnames begin to look alike.

If you use database objects you can solve both problems. Instead of this:

AG->AGGROEP := cAGGROEP
AG->AGSRTNR := cAGSRTNR
AG->AGSRTNRN := cAGSRTNRN
AG->AGVERGNR := cAGVERGNR
AG->AGVERGNRN := cAGVERGNRN

You would have this:

oAG:GROEP := cGROEP
oAG:SRTNR := cSRTNR
oAG:SRTNRN := cSRTNRN
oAG:VERGNR := cVERGNR
oAG:VERGNRN := cVERGNRN

You can also increase the length of your fieldnames to 8 characters so they are more readable. Granted this is not feasible for an existing app.

However, you don't even need to use memory variables, you can assign data directly like this:

oAG:GROEP := "cat"
oAG:SRTNR := "mouse"
oAG:SRTNRN := "frog"
oAG:VERGNR := "dog"
oAG:VERGNRN := "goose"

Now, since you are using the database object instead of memory variables the database ID is obvious (oAG) and you still have more readable fieldnames. I don't know your language, but for example, in English, you can use syntax like:

oCustomer:Address

Which is pretty clear. Much more clear than something like cCUADR.

Also, when using the above syntax, you eliminate all the scatter/gather code and just assign data directly to the database object. Note that the data is being assigned to a buffer so you can cancel the transaction if desired. To cancel you just do nothing, or to save it to the DBF you just do:

oCustomer:save()

Wow, how simple is that!

Once you start coding like this, you can write much smaller routines that are easier to read, and thus you will have fewer bugs. Also, since the code is smaller it will use less memory and execute faster.

You can read more about database objects on my website at http://www.gointellitech.com.

James
User avatar
David Williams
Posts: 82
Joined: Fri Mar 03, 2006 6:26 pm
Location: Ireland

Re: Very strange indexing problem

Post by David Williams »

Michel,

That is very good advice from James. I'm glad you have solved your (our) problem.

Merry Christmas to Everyone.

David :D
Post Reply