Xpage and querysavedocument

Hello,

I’m new on xpages…

I have an xpage who stores customers informations (name, adress, phone…)

Each customer has a sequential number stores in number field.

myview is the view of customers documents.

In my xpage i write in event → datas → document → querysavedocument something like :

var v=database.getview(“myview”)

var doc=v.getlastdocument

var num=doc.getitemvalue(“number”)

num=num+1

document.replaceItemValue(“Number”,num)

when i submit my xpage, selected option is display the same xpage then number field is not refreshed and new value is not display.

Have you a solution to display new value stored in background document ?

Best regards

Subject: Is any data saved in the document?

Subject: Yes, all datas saved

Thanks a lot for answer.

Yes, all datas are saved.

Process :

When i open a new customer xpage i can complete name, adress, phone, …

On Save button onclick Event : Document-> Simple action → Save Document.

and

Xpage → Events → Datas → document → postSaveDocument (or querysavedocument = same result): following script :

var agent=database.getAgent(“SauveCorrespondantPrincipal”);

agent.runOnServer(document1.getNoteID());

Agent code sample (for test, not incremental but same result):

Sub Initialize

Dim db As NotesDatabase

Dim s As New notessession

Dim agent As NotesAgent

Dim doc As notesdocument

Set agent=s.CurrentAgent

Set db = s.CurrentDatabase

Set doc = db.GetDocumentByID

(agent.ParameterDocID)

Call doc.replaceitemvalue(“Numero”,“test”)

Call doc.save(True,False)

End Sub

After submit field Numero still blank on xpage (it’s my problem), he is not reloaded in xpage from notes document. Aall others datas are displayed (address, name, etc…)

If i open the xpage from customers view : Numero is displayed.

I have also tried to add this code to agent :

vhtml=“”

vHTML=vHTML+“”

Print vHTML

Same result : Numero still blank