Backend not updating

What am I doing wrong. I’m trying to replace a value in the backend and make it show up in the front end.

I thought I could use the notesuidocument to get to the notesdocument and use the uidoc.autoreload=true so the chages automatically show up in the front end. I’m messing up setting that backend doc. I’ve tried all sorts of things. Can someone tell me what I’m doing wrong, thanks!!!

Sub Initialize

Dim workspace As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Dim doc As NotesDocument

Dim newdate As String

Set uidoc = workspace.CurrentDocument

Set doc = uidoc.Document

uidoc.autoreload = True	

Dim item As NotesItem

newdate = Inputbox(“Enter a date (mm/dd/yyyy format)”, “ABC Company - Review”)

If newdate = "" Then

	Msgbox "Review Canceled...", MB_OK, "ABC Company - Review"

	Exit Sub

End If

If doc.Agreement_Cost(0) <= 10000 Then

	smtemp1 = Strleft(doc.DispSMApp(0), "-")

	smtemp2 = smtemp1 & "-" & " " & newdate

	Set item = doc.ReplaceItemValue( "doc.DispSMApp(0)", smtemp2 )

            doc.DispSMApp = doc.DispSMApp(0)

	

Else

	dmtemp1 = Strleft(doc.DispDMApp(0), "-")

	dmtemp2 = dmtemp1 & "-" & " " & newdate

	dmtemp2 = doc.DispDMApp(0) 

	Set item = doc.ReplaceItemValue( "doc.DispDMApp(0)", dmtemp2 )

            doc.DispDMApp = doc.DispDMApp(0)

End If

Msgbox “Review Date set to” & " " & newdate, MB_OK, “ABC Company - Review”

End Sub

Subject: backend not updating

What are thes lines for? Update…???..document???

Set item = doc.ReplaceItemValue( “doc.DispSMApp(0)”, smtemp2 )

doc.DispSMApp = doc.DispSMApp(0)

Replace the above code lines with

Set item = doc.ReplaceItemValue(“DispSMApp”, smtemp2 )

or

doc.DispSMApp = smtemp2

Either of these two updates the value. Implement the same in your other variable too.

Remove this line ---->doc.DispSMApp = doc.DispSMApp(0)

Subject: RE: backend not updating

I was trying to avoid the “item” part. I was trying to set the backend field so the front end automatically updates.

Will this though update the backend field?

doc.DispSMApp = smtemp2

Subject: RE: backend not updating

Color me stupid but why do you never save the changes to your backend?

Subject: RE: backend not updating

Forgive me, I’ll still new to this.

My question is when I replace the value this way

doc.DispSMApp = smtemp2

then will 2 versions of the document be created? I want to make sure my code is correct and will not cause conflicts. I was thinking that I could save the docuent in the backend and automatically show the changes to the front end. Maybe I’m looking at this too much.

…takend from a help book…

When documents stored in the database(notesdocument) are accessed through the document in the user interface (notesuidocument), the two versions of the document must be synchronized. Is some cases, the synchronization happens automatically. In others, code forces the synchronization.

Subject: RE: backend not updating

The frontend/backend stuff can become very tricky, especially with RTF fields.

There won’t ever be 2 documents stored. Whatever saves last will be stored to disk, so if you do

doc.yourfield = thisvalue

and you call uidoc.save, doc.yourfield will be overwritten with whatever is in uidoc.yourfield.

Subject: RE: backend not updating

Thanks for the info!

Subject: RE: backend not updating

Also, will this cause replication conflicts the way I’m doing this? It’s working now but I want to make sure the back end updates withouth causing conflicts.