Need help with uidoc.refresh to display value set to back-end

This should be fairly simple but something quirky is going on with my script and I need an extra pair of eyes. I thought as long as a value is saved in the back-end then it should be displayed in the front-end once refreshed. This seems to work sometimes (eg. a recently opened document) but not always. Going through the debugger, I see the value is changed and saved in the back-end but the refresh then overwrites the saved value with the original front-end value. No values are being updated in the front-end anywhere in this script. I’ve tried using reload but to no avail.

I’ve posted a snippet of my code below. this is executed from a button in a document displayed in edit mode. ‘Doc’ represents the document being displayed:

if subj.SubjCount(0) = subj.SubjRecdCount(0) Then

			'Then we know that subjcount is not 0 from the previous test and the same number of date stamps have been checked as subjectivities so we can mark as complete

					Call subj.MakeResponse(doc)

					Call subj.Save(True, True)

					Call doc.ReplaceItemValue("SubjPending" & n, "")

					Call doc.ReplaceItemValue("SubjCompDate" & n, compDate.DateOnly)

					Call doc.Save(True, False)

					Call uidoc.Refresh

					Exit Sub

End If

Appreciate any suggestions!

Tina

Subject: Need help with uidoc.refresh to display value set to back-end

are your fields computed? if you save it and then refresh at the ui level, I believe the computed values will recalculate. Instead, try uidoc.Reload…then you will need to save it at the uidoc level as well. I think this will help.

Subject: RE: Need help with uidoc.refresh to display value set to back-end

Thanks for your response.

If I save it at the UI level without writing it to the front-end then wouldn’t the front-end value over-write the back-end?

It would be great if I could write it to the front end but the fields are Computed when composed which results in an error if I use uidoc.FieldSetText.

Should I change these fields to Computed? I’d hate to do this since there are several of these fields and I wouldn’t want to have them recalc on every refresh/save event.

Subject: Try:

Call doc.ReplaceItemValue("SubjCompDate" & n, compDate.DateOnly)	Call doc.Save(True, False)

Call uidoc.Reload

Call uidoc.Refresh

Exit Sub