From: Jean-Pierre Maertens on
Hello guys,

Have something I don't understand. The code hereafter is called by a bbrowser column. It works fine in the IDE. The same code in the runtime version (same CAVO28 map) fails. In runtime self:odbCataloog:reccount is 0 ???

this is the code that calls the method "Toontrefwoorden" in bBrowser
oKolom:=bDataColumn{self:oDCbBReservaties,self:oServer,{|oS,me| me:ToonTrefwoorden()},#Expression,self}
this is the method that goes wrong in runtime :
Method ToonTrefwoorden() class ShowReservatiesNew
local cTrefwoord as string
local cResid as string
cResid:=self:oServer:FIELDGET(#id)
cTrefwoord:=""

self:odbtrefwoord:OrderTopScope:=cResid
self:odbtrefwoord:OrderBottomScope:=cResid
self:odbtrefwoord:GoTop()

// there is a relationship between odbtrefwoord and odbCataloog

while !self:odbtrefwoord:EoF
cTrefwoord:=cTrefwoord+Trim(self:odbCataloog:FIELDGET(#woord))
self:odbtrefwoord:Skip(1)
if !self:odbtrefwoord:EoF
cTrefwoord:=cTrefwoord+" + "
endif
enddo

return cTrefwoord


For the time being I have replaced the code with an sql statement (that works MUCH slower)

cSelect:="Select * from tref left join Cataloog on cataloog.id=tref.catid where tref.resid ='"+self:oServer:FIELDGET(#id)+"' "
oTref:=AdsSQLServer{ cSelect , , , "AXSQLCDX" }
cTrefwoord:=""
while !oTref:EoF
cTrefwoord:=cTrefwoord+oTref:FIELDGET(#woord)
oTref:Skip(1)
enddo
return cTrefwoord

--
Jean-Pierre Maertens

From: Geoff Schaller on
J-P,

You didn't say where it went wrong. Also, what are you doing here? If it
is concatenating field values into a single string you could do this
with a single statement rather than a loop.

Geoff



"Jean-Pierre Maertens" <jean-pierre.GEENSPAMmaertens(a)bruggeGEENSPAM.be>
wrote in message news:hjse6r$pj5$1(a)ikarus.fw.belnet.be:

> Hello guys,
>
> Have something I don't understand. The code hereafter is called by a bbrowser column. It works fine in the IDE. The same code in the runtime version (same CAVO28 map) fails. In runtime self:odbCataloog:reccount is 0 ???
>
> this is the code that calls the method "Toontrefwoorden" in bBrowser
> oKolom:=bDataColumn{self:oDCbBReservaties,self:oServer,{|oS,me| me:ToonTrefwoorden()},#Expression,self}
>
> this is the method that goes wrong in runtime :
>
> Method ToonTrefwoorden() class ShowReservatiesNew
> local cTrefwoord as string
> local cResid as string
>
> cResid:=self:oServer:FIELDGET(#id)
> cTrefwoord:=""
>
> self:odbtrefwoord:OrderTopScope:=cResid
> self:odbtrefwoord:OrderBottomScope:=cResid
> self:odbtrefwoord:GoTop()
>
> // there is a relationship between odbtrefwoord and odbCataloog
>
> while !self:odbtrefwoord:EoF
> cTrefwoord:=cTrefwoord+Trim(self:odbCataloog:FIELDGET(#woord))
> self:odbtrefwoord:Skip(1)
> if !self:odbtrefwoord:EoF
> cTrefwoord:=cTrefwoord+" + "
> endif
> enddo
>
> return cTrefwoord
>
>
> For the time being I have replaced the code with an sql statement (that works MUCH slower)
>
> cSelect:="Select * from tref left join Cataloog on cataloog.id=tref.catid where tref.resid ='"+self:oServer:FIELDGET(#id)+"' "
>
> oTref:=AdsSQLServer{ cSelect , , , "AXSQLCDX" }
>
> cTrefwoord:=""
>
> while !oTref:EoF
>
> cTrefwoord:=cTrefwoord+oTref:FIELDGET(#woord)
>
> oTref:Skip(1)
>
> enddo
>
> return cTrefwoord
>
>
> --
> Jean-Pierre Maertens

From: Jean-Pierre Maertens on
Geoff,

Where ever in the method "toontrefwoorden" I access the table
odbCataloog, it seems as if the table is empty. odbcataloog:woord
should return a string, or at least an empty string, but it doesn't. So
bbBrowser just puts "NIL" in the column, meaning it does not reach the
end of the method but rather jumps to an exception. While in runtime
it does work (and several comparable methods on other tables work in
both cases. I am at a loss :) for the moment.

> J-P,
>
> You didn't say where it went wrong. Also, what are you doing here? If it is
> concatenating field values into a single string you could do this with a
> single statement rather than a loop.

you mean in the sql statement ? OK, I have put that in as a temporary
workaround because the method takes on average 2 milliseconds when I
access the tables as dbf and more than 10 milliseconds as sql. As
these methods are called hundreds of times by bBrowser, there is need
for speed :)

JP
>
> Geoff
>
>
>
> "Jean-Pierre Maertens" <jean-pierre.GEENSPAMmaertens(a)bruggeGEENSPAM.be> wrote
> in message news:hjse6r$pj5$1(a)ikarus.fw.belnet.be:
>
>> Hello guys,
>>
>> Have something I don't understand. The code hereafter is called by a
>> bbrowser column. It works fine in the IDE. The same code in the runtime
>> version (same CAVO28 map) fails. In runtime self:odbCataloog:reccount is 0
>> ???
>>
>> this is the code that calls the method "Toontrefwoorden" in bBrowser
>> oKolom:=bDataColumn{self:oDCbBReservaties,self:oServer,{|oS,me|
>> me:ToonTrefwoorden()},#Expression,self}
>>
>> this is the method that goes wrong in runtime :
>>
>> Method ToonTrefwoorden() class ShowReservatiesNew
>> local cTrefwoord as string
>> local cResid as string
>>
>> cResid:=self:oServer:FIELDGET(#id)
>> cTrefwoord:=""
>>
>> self:odbtrefwoord:OrderTopScope:=cResid
>> self:odbtrefwoord:OrderBottomScope:=cResid
>> self:odbtrefwoord:GoTop()
>>
>> // there is a relationship between odbtrefwoord and odbCataloog
>>
>> while !self:odbtrefwoord:EoF
>> cTrefwoord:=cTrefwoord+Trim(self:odbCataloog:FIELDGET(#woord))
>> self:odbtrefwoord:Skip(1)
>> if !self:odbtrefwoord:EoF
>> cTrefwoord:=cTrefwoord+" + "
>> endif
>> enddo
>>
>> return cTrefwoord
>>
>>
>> For the time being I have replaced the code with an sql statement (that
>> works MUCH slower)
>>
>> cSelect:="Select * from tref left join Cataloog on cataloog.id=tref.catid
>> where tref.resid ='"+self:oServer:FIELDGET(#id)+"' "
>>
>> oTref:=AdsSQLServer{ cSelect , , , "AXSQLCDX" }
>>
>> cTrefwoord:=""
>>
>> while !oTref:EoF
>>
>> cTrefwoord:=cTrefwoord+oTref:FIELDGET(#woord)
>>
>> oTref:Skip(1)
>>
>> enddo
>>
>> return cTrefwoord
>>
>>
>> --
>> Jean-Pierre Maertens

--
Jean-Pierre Maertens


From: Jean-Pierre Maertens on
Geoff,

As I thought this had nothing to do with the code at that point, in the
beginning of the program I had a few "memory" lines from the old days :

SetMaxDynSize( 0x12000000) // 300 MB dynamic RAM
DynSize (1024)

after I removed that everything worked fine. Thanks for your input.
Greetings from Belgium

--
Jean-Pierre Maertens


From: Geoff Schaller on
J-P,

Interesting. So you are saying that removing the ability to run up a big
Dyn RAM bill solved the problem?

But I'm interested in another aspect of your code. You appear to be
using SetRelation() and under SQL, this is a tragic performance killer.
We replace all code with joined selects. No more relation.

Cheers,

Geoff



"Jean-Pierre Maertens" <jean-pierre.GEENSPAMmaertens(a)bruggeGEENSPAM.be>
wrote in message news:hju8f7$q2a$1(a)ikarus.fw.belnet.be:

> Geoff,
>
> As I thought this had nothing to do with the code at that point, in the
> beginning of the program I had a few "memory" lines from the old days :
>
> SetMaxDynSize( 0x12000000) // 300 MB dynamic RAM
> DynSize (1024)
>
> after I removed that everything worked fine. Thanks for your input.
> Greetings from Belgium
>
> --
> Jean-Pierre Maertens

 | 
Pages: 1
Prev: Who wants an iPad?
Next: Barcodes