Copy of UI-Document

Hi Community,

how can I save an already saved and currently opened Doc (Client) with the same form but with another DocUniqueId = Duplicate the Doc

Formula-Language prefered, LS also OK

Thx for any suggestion

Stephan

Subject: Create copy of open document

There are two methods I would consider. Which one you chosse depends on if you want to/can save the document before you create the copy, or if you want to copy the open document “as is” without saving it first.

If saving first is OK, I would do something like this:

Call uidoc.Save()

Set newdoc = uidoc.Document.CopyToDatabase(thisdb)

That’s it.

If you want to create a copy of the currently open document, in it’s current state but without saving it, you can simply expand on the above code by looping through all items and copy the UI representation of them to the new document:

Forall i in newdoc.Items

Call newdoc.ReplaceItemValue(i.Name, uidoc.FieldGetText(i.Name))

End Forall

Call newdoc.ComputeWithForm(True,False)

Call newdoc.Save(True,False)

Subject: Thank you

Hi,

thank you very much for the quick help.

Yr suggestion #2 is the way i meant i had to go like, but i think it’s a little bit like “wild-west”-development …

So i’ll realize my prob by using your suggestion #1

thanks for help

Stephan

Kleve/Germany

Subject: No problem

Yr suggestion #2 is the way i meant i had >to go like, but i think it’s a little bit

like “wild-west”-development …

I don’t see any major issues with using method 2, as long as you don’t update the backend version of the document.