Update computed field in backend

I’ve searched this forum for 2 days and found a lot of posts about this issue without a definite answer.

I’ve a form with 3 fields A,B,C … A,B fields are editable fields I set in agent. Field C is a computed field: C=A+B

I create a document in backend:

Set doc = db.CreateDocument

doc.fieldA = 5

doc.fieldB = 2

Call timeDoc.ComputeWithForm(True,True)

Call doc.Save(False,True)

The problem is, that when i open my form for the first time, I don’t see the C field computed. I have to resave the form. Then it’s ok.

Any idea, how to update it in backend?

Subject: Update computed field in backend

Add the line below to your code, when saving doc for the first time.

doc.fieldC = doc.fieldA(0) + doc.fieldB(0)

Subject: RE: Update computed field in backend

Yadzi,

thx a lot for your response … However the ComputeWithForm function suddenly start to work for me … I’ve tested it 20 times before and it was not, now it is. Don’t ask me, how is this possible. I think, it’s time for a good beer. This is not the only thing I managed to solve today ;o)