From: Grant on
I have found the problem that I posted about previously 'Lost Server
in bBrowser3' -July 8. It seems to be related to setting a scope. I am
reposting because my question is a little different from the first one
and I didn't want to clutter up this post.

When I set a scope in the postinit of the bBrowser window and then
append a new record I can add data to the record but I can't move the
cursor up to the previous record and when the Enter key is pressed the
data is lost.
The record is saved but the data is not. The scope is created as
follows with cFName being the customer name.
odbsServer:OrderScope(TOPSCOPE, cFName )
odbsServer:OrderScope(BOTTOMSCOPE, cFName )
odbsServer:GoTop()
Then I used the method RecordAppend(oEvent) and the bBrowser display
is set for edit
oEvent:Control:Edit()

If I do not create a scope it works fine and I can append a record and
enter data, edit and move from cell to cell up or over and all the new
data is saved.

What is it about setting a scope that disconnects the browser from the
server temporarily? If I start the display one record before the
newly appended record then all is ok
oDCbBrowser1:Skip(-1)
but this is not a good solution.

Should I change from using OrderScope to SetFilter or ??? so far I
haven't got anything else working either.

any help would be greatly appreciated.
Thankyou
From: richard.townsendrose on
Grant

there are really two solutions: depends on how you are providing the
new data.

a) have a second server unscoped server
make your self:myunscopedserver:append()
and fill with data affecting the scope at the very least
make a commit()
then notify the first server of a file change
self:myfirstserver:notify(NOTIFYFILECHANGE)

b) mucking about ....
suspend notification - so as to leave the browse unchanged
unscope the server
make your append() and fill with data
commit()
reset the scope
reset notification
refresh the browse.
nb: you can actually get the record no, and goto() it but not if you
are displaying the new record.

personally i go for the first way because we use advantage and
additional dbserver connections [to the same server] have virtually no
overhead.

richard
From: Karl Faller on
Grant,
>What is it about setting a scope that disconnects the browser from the
>server temporarily?
Depending on your append implementation probably the scope key val in
your new rec is missing, or outside the scope...

Karl
From: Stephen Quinn on
Grant

> What is it about setting a scope that disconnects the browser from the
> server temporarily?
There is NO disconnection at all, when you set a SCOPE and there are NO
records matching that SCOPE you will see nothing in the browser.

You should eiher use a separate window to gather details for the new record
and then save them
or
when appending the new record you should at least write data into the
necessary field(s) that match the index/scope to have something appear in
the browser.
Eg
odbsServer:SuspendNotification()
odbsServer:Append()
odbsServer:FNAME := cFName
odbsServer:Commit()
odbsServer:OrderScope(TOPSCOPE, cFName )
odbsServer:OrderScope(BOTTOMSCOPE, cFName )
odbsServer:ResetNotification()
odbsServer:GoTop()

Your best bet IMO is to NOT do any editing in a browser at all.
All I ever did was checkboxes and numerical data entry in the bbrowser code
I wrote.

What you should do is restore the previous view if there's nothing to see
Eg
xScope := // Save current order/scope
odbsServer:OrderScope(TOPSCOPE, cFName )
odbsServer:OrderScope(BOTTOMSCOPE, cFName )
IF odbsServer:OrderKeyCount() = 0

// RESTORE the previous view
odbsServer:ClearScope() // if there was no previous scope

// or if you saved it
// odbsServer:OrderScope(TOPSCOPE, xScope )
// odbsServer:OrderScope(BOTTOMSCOPE, xScope )
ENDIF

CYA
Steve