“Duplicate Document” changes field contents in original – field IDs the same?

Tap Forms – Organizer Database App for Mac, iPhone, and iPad Forums Script Talk “Duplicate Document” changes field contents in original – field IDs the same?

Viewing 4 reply threads
  • Author
    Posts
  • June 12, 2023 at 10:16 PM #49584

    alang
    Participant

    Hi Brendan,

    I used “Duplicate Document” from the “Database Documents” window to make a copy of a document for testing. When using the duplicate test document, I was confused when a script which changed field contents also changed contents of the field with the same name but in the original document I had made a copy of. I think what is going on is “Duplicate Document” made an exact copy of the script, which means the field IDs are the same in the original document and in the copied document. I am guessing that is why a script in the duplicated document is making changes to the original document.  If this is the case, I am wondering if this is expected behavior. Thank you.

    June 12, 2023 at 10:28 PM #49585

    alang
    Participant

    Don’t know if I should have rewrote my original post.  But looking at this further, I think “Duplicate Document” is referencing the same actual script object?  When I make a change to the script in the duplicate document, those edits appear in the script in the original document.

    June 14, 2023 at 12:03 AM #49587

    Brendan
    Keymaster

    Hi Alan,

    The Duplicate Document function just takes a copy of the document as is, copies it, and assigns it a new, unique Document ID. That’s all it does. So all field IDs, record IDs, form IDs, and so on will all be identical.

    But a script should not make changes to a different document. It should still only operate on its own forms.

    Can you check the Document IDs on each document to see if they are in fact different?

    Thanks,

    Brendan

    June 14, 2023 at 10:41 PM #49599

    alang
    Participant

    Hi Brendan,

    Well I am certainly baffled.  I wanted to make sure this issue could be reproduced.  I deleted the copy of the document and then made a new Duplicate.  Both the Duplicate and the Original were set up to sync in iCloud.  What I did this time, unlike when the problem was occurring, was to wait for the sync to complete.  At that point, I was unable to reproduce the problem.  I had checked when the problem was occurring to see if the Document IDs were different, and they were.  Other than waiting for the sync, I don’t know what I did differently.  I do appreciate your explanation and I am sorry for what seems to have been, to at least some degree, a waste of your time.  Thank you!

    June 16, 2023 at 10:28 AM #49609

    Brendan
    Keymaster

    Hi Alan,

    It’s never a waste of my time to ask me a question. I’m just happy you were able to get past this issue.

    Thanks,

    Brendan

    June 16, 2023 at 10:34 AM #49610

    alang
    Participant

    Thank you!

Viewing 4 reply threads

You must be logged in to reply to this topic.