From: Grant on
Hello All
I have a bBrowser that I want to append a new record to but I'm losing
the connection to the server when I press
the 'New' button. The new record appends fine and it is open in Edit
mode but as soon as I change focus to the next cell in the record the
data is lost. Here is the 'OnInsert' method :
METHOD OnInsert() CLASS dtwJOB
//append a new record
IF self:oDCbBrowser1:Used

IF self:oDCbBrowser1:Append()
self:oDCbBrowser1:Server:SuspendNotification()
self:oDCbBrowser1:Server:FIELDPUT(#JDATE, Today())
self:oDCbBrowser1:Server:FIELDPUT(#CUSTOMER, cFName)
self:oDCbBrowser1:Server:ResetNotification()
self:oDCbBrowser1:Server:Commit()
self:oDCbBrowser1:Refresh()
self:oDCbBrowser1:CurrentColumn:= 2
self:oDCbBrowser1:Edit()
ENDIF
ENDIF
Return true
From: Grant on
On Jul 8, 4:51 pm, Grant <gra...(a)dunsmoreinfo.com> wrote:
> Hello All
> I have a bBrowser that I want to append a new record to but I'm losing
> the connection to the server when I press
> the 'New' button. The new record appends fine and it is open in Edit
> mode but as soon as I change focus to the next cell in the record the
> data is lost. Here is the 'OnInsert' method :
>       METHOD OnInsert() CLASS dtwJOB
> //append a new record
> IF self:oDCbBrowser1:Used
>
>         IF self:oDCbBrowser1:Append()
>                 self:oDCbBrowser1:Server:SuspendNotification()
>                 self:oDCbBrowser1:Server:FIELDPUT(#JDATE, Today())
>                 self:oDCbBrowser1:Server:FIELDPUT(#CUSTOMER, cFName)
>                 self:oDCbBrowser1:Server:ResetNotification()
>                 self:oDCbBrowser1:Server:Commit()
>                 self:oDCbBrowser1:Refresh()
>                 self:oDCbBrowser1:CurrentColumn:= 2
>                 self:oDCbBrowser1:Edit()
>         ENDIF
> ENDIF
> Return true

Sorry - hit a key and posted before I wanted to. The browser is in
edit mode and I can add/edit the data fine. When I add a record it
adds it but I lose connection with the server untill I move the
cusrsor off the record and then back. Can someone explain what is
happening?
I am also using a 'CellEdit' which I think allows me to edit the cells
in the browser and this works fine until I add a new record. Any
advice will be appreciated. VO stills has many mysteries.
Thank you
Grant
From: Stephen Quinn on
Grant

Sounds like your not adding any data to the index key (or matching
scope/filter) fields when you Append()

CYA
Steve


From: Kevin on
Grant,

A few things based on the code you posted:

1. Move the Server:SuspendNotification to before the IF where you
Append.
2. Put a Server:ResetNotification after the corresponding ENDIF. As far
as I know these calls are nested and without the Reset you are just
building them up and this may be the problem.
3. Commit the changes.
4. Refresh the browser.

For example:

If self:oDCbBrowser1:Used
Self:oDCbBrowser:SuspendNotification()

If Self:oDCbBrowser1:Append()
//Insert your data
Self:oDCbBrowser1:server:Commit()
Endif

Self:oDCbBrowser:ResetNotification()
Self:oDCbBrowser1:Refresh()

Endif


Hope this helps.

Kevin

"Grant" <grantd(a)dunsmoreinfo.com> wrote in message
news:a57ef155-8c4c-477b-8566-78ba2de44939(a)x2g2000prk.googlegroups.com:

> Hello All
> I have a bBrowser that I want to append a new record to but I'm losing
> the connection to the server when I press
> the 'New' button. The new record appends fine and it is open in Edit
> mode but as soon as I change focus to the next cell in the record the
> data is lost. Here is the 'OnInsert' method :
> METHOD OnInsert() CLASS dtwJOB
> //append a new record
> IF self:oDCbBrowser1:Used
>
> IF self:oDCbBrowser1:Append()
> self:oDCbBrowser1:Server:SuspendNotification()
> self:oDCbBrowser1:Server:FIELDPUT(#JDATE, Today())
> self:oDCbBrowser1:Server:FIELDPUT(#CUSTOMER, cFName)
> self:oDCbBrowser1:Server:ResetNotification()
> self:oDCbBrowser1:Server:Commit()
> self:oDCbBrowser1:Refresh()
> self:oDCbBrowser1:CurrentColumn:= 2
> self:oDCbBrowser1:Edit()
> ENDIF
> ENDIF
> Return true

From: richard.townsendrose on
Grant,

When you suspend the notification, the that means that the server is
NOT telling bbrowser that anything has changed.

best to issue a Server:Notify(NotifyFileChnage)

alos do you have a bbrowser:celledit(oEvent) method ?

if you do then you can do the commit within it... here's some code
where we edit a browse...
METHOD CellEdit(oEvent) CLASS Documents
LOCAL oColumn AS bDataColumn
LOCAL auType AS ARRAY
LOCAL cRev AS STRING

IF oEvent:EditMode=BEDIT_CREATE
oColumn := oEvent:Control:GetOpenColumn(oEvent:EditCell:Column)
IF oColumn:NameSym=#REVNO2
oEvent:EditControl :=
SELF:oDCGotDocs:EditCreate(oEvent:EditCell:Column,
oEvent:EditCell:Row, oEvent:EditCell:RecNo, #ComboBox, ,
BOXDROPDOWNLIST)
IF oEvent:EditControl<>NULL_OBJECT
auType := SELF:Owner:CreateRevArray(SELF:oSELDC:FIELDGET(#MADEBY)
+SELF:oSELDC:FIELDGET(#CLIENTDRG))
IF ! Empty(auType)
oEvent:EditControl:FillUsing(auType)
ENDIF
ENDIF
ENDIF
ENDIF

IF oEvent:EditMode=BEDIT_COMMIT
oColumn := oEvent:Control:GetOpenColumn(oEvent:EditCell:Column)
IF oColumn:NameSym=#REVNO2
cRev:=oColumn:VALUE
IF cRev == 'Nul' // have to convert back from rev as
shown
cRev:=Space(3)
ENDIF
IF SELF:TabVarget(#DOCSRC) == 'N'
SELF:oSELDC:FIELDPUT(#REVNO, NRevWrite(SELF:TabVarget(#JobNo),
SELF:oSELDC:FIELDGET(#MADEBY), cRev))
ELSE
SELF:oSELDC:FIELDPUT(#REVNO, RevWrite(cRev))
ENDIF
SELF:oSELDC:Commit()
SELF:Owner:SetTSRevNo(SELF:oSELDC:FIELDGET(#MADEBY) +
SELF:oSELDC:FIELDGET(#CLIENTDRG), SELF:oSELDC:FIELDGET(#REVNO))
ENDIF
IF oColumn:FieldSym=#DRGMATE
SELF:oSELDC:Commit()
SELF:Owner:SetTSDocMaterial(SELF:oSELDC:FIELDGET(#MADEBY) +
SELF:oSELDC:FIELDGET(#CLIENTDRG), SELF:oSELDC:FIELDGET(#DRGMATE),
SELF:oSELDC:FIELDGET(#DRGTYPE)+SELF:oSELDC:FIELDGET(#DRGSIZE))
ENDIF
ENDIF

RETURN TRUE