Author | Topic: Bug in SEEK combined with filters and relation? | |
---|---|---|
Klemens Lichter | Bug in SEEK combined with filters and relation? on Wed, 01 Apr 2009 12:05:55 +0200 Hi, the following scenario: select 1 use adress1.dbf alias adressen set index to index1.ntx key = str(nummer,6) select 2 use adress2.dbf dbsetrelation( "ADRESSEN", { || str(nummer,6) }, "str(nummer,6)" ) ordcreate("index2.ntx",,"landkenn()+vpplz()+vpmenge()") up to here all is OK, if I skip backward or forward in adress2 the records in adress1 are synchronized. dbclearrelation() select 1 dbsetfilter( { || status < "2" }) go top select 2 dbsetfilter( { || CODE =="TEST " }) go top dbsetrelation( "ADRESSEN", { || str(nummer,6) }, "str(nummer,6)" ) go top up to here all is OK, if I skip backward or forward in adress2 the records in adress1 are synchronized. dbseek( "d ") here with dbseek() my problems start.. FUNCTION LANDKENN() local cRet := "" if uper(adressen->land) == "D " cRet := "d " else cRet := upper(adressen->land) endif return cRet FUNCTION VPPLZ() local cRet := strtran(adressen->plz,"O","0") return cRet FUNCTION VPMENGE() local cRet := str(adressen->menge,5) return descend(cRet) dbseek() returns .F. but there are lots of records in adress1 with should generate "d " in the landkenn()-function. adress2 is now eof() and adress1 shows an empty record with record number lastrec()+1 but eof() is .F. (should be .T. at that moment) In the debugger I can see that during seek the function Landkenn() is called but it can´t get the right answer because in adress1 there is not the correct record found. In the data the field NUMMER (what makes the relation) is in both dbf and in both dbf there is a record with the same number in it. also the filterexpression in adress1 does not filter this record off. This code was running fine for years with Clipper and now after recompiling with xBase++ it fails. What is wrong? Klemens | |
Edgar Borger | Re: Bug in SEEK combined with filters and relation? on Wed, 01 Apr 2009 13:34:12 -0300 Klemens, what xbase version ? with 1.90.331 there is a bug with seek and set delete on and set lex rules, if I remember correct it is pdr 6061 and there is a fix for it, maybe this is your case. Regards, Edgar Klemens Lichter escreveu: > Hi, > > the following scenario: > > select 1 > use adress1.dbf alias adressen > set index to index1.ntx key = str(nummer,6) > select 2 > use adress2.dbf > dbsetrelation( "ADRESSEN", { || str(nummer,6) }, "str(nummer,6)" ) > ordcreate("index2.ntx",,"landkenn()+vpplz()+vpmenge()") > > up to here all is OK, if I skip backward or forward in adress2 the > records in adress1 are synchronized. > > > dbclearrelation() > select 1 > dbsetfilter( { || status < "2" }) > go top > select 2 > dbsetfilter( { || CODE =="TEST " }) > go top > dbsetrelation( "ADRESSEN", { || str(nummer,6) }, "str(nummer,6)" ) > go top > > up to here all is OK, if I skip backward or forward in adress2 the > records in adress1 are synchronized. > > dbseek( "d ") > > here with dbseek() my problems start.. > > FUNCTION LANDKENN() > local cRet := "" > if uper(adressen->land) == "D " > cRet := "d " > else > cRet := upper(adressen->land) > endif > return cRet > > FUNCTION VPPLZ() > local cRet := strtran(adressen->plz,"O","0") > return cRet > > FUNCTION VPMENGE() > local cRet := str(adressen->menge,5) > return descend(cRet) > > dbseek() returns .F. but there are lots of records in adress1 with should > generate "d " in the landkenn()-function. adress2 is now eof() and adress1 > shows an empty record with record number lastrec()+1 but eof() is .F. > (should be .T. at that moment) In the debugger I can see that during seek > the function Landkenn() is called but it can´t get the right answer because > in adress1 there is not the correct record found. In the data the field > NUMMER (what makes the relation) is in both dbf and in both dbf there is a > record with the same number in it. also the filterexpression in adress1 does > not filter this record off. > > This code was running fine for years with Clipper and now after recompiling > with xBase++ it fails. What is wrong? > > Klemens > | |
Klemens Lichter | Re: Bug in SEEK combined with filters and relation? on Thu, 02 Apr 2009 20:10:17 +0200 After long search in the KB I think that PDR 6081 comes close to the problem... Klemens |