A True Copy

I want to select documents in a view and copy them to another view. I want to make a true copy not just a reference to the same selected documents. How can this be done using an action button in the view?
schmad01Asked:
Who is Participating?
 
Sjef BosmanConnect With a Mentor Groupware ConsultantCommented:
C'mon, that's one thing I hope you can do yourself...

A 99% hint: look at the line with newdoc.Form
0
 
Sjef BosmanGroupware ConsultantCommented:
I was starting with:

    @Command( [EditCopy] );
    @Command( [OpenView] ; viewName ; key ; newinstance )
    @Command( [EditPaste] )

and then I wondered... Copy from one view to another view? In the same database? Documents are not "in" a view, documents are selected by a view for display. Or do they have to be copied to another database?
0
 
schmad01Author Commented:
Well, true, I know, I was just using wording it that way so the experts would understand what I want. So, I guess what I am asking is to make a copy to the same database. Now, I am thinking, if I do that, how will a document be distinguished from it's copy? A value in a hidden field?
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
Sjef BosmanGroupware ConsultantCommented:
A copy of a document is in all respects the same, only the hard Notes values are set to indicate a new document: Date Created, Date Modified, Creator, and the NoteID and UniversalID. The fields are the same, even the Form field, which means that if you copy a document from one view and paste it into another, it won't show up (normally) in the view you paste it in unless the Select statement of that view would include that document. It will however appear in the original view, as a duplicate of the original document.

Why the copy, why do you need it?? There may be other Notes built-in mechanisms that might prove to be more interesting than a mere copy/paste.
0
 
marilyngCommented:
Maybe set the versions, so that new versions are the main and previous ones are the replica. ? Just a thought. :)
0
 
Sjef BosmanGroupware ConsultantCommented:
That's my drift, yes... (as implied by "other Notes built-in mechanisms")
0
 
marilyngCommented:
Grin - I seem to recall in a previous question you got the points for specifiying the two  Todo views I missed, in spite of my inference that the views were there.

But, yes, versions can be considered "other Notes built-in mechanisms."  Most people ignore these, and they are quite usefull.
0
 
Sjef BosmanGroupware ConsultantCommented:
No hard feelings... LOL
0
 
schmad01Author Commented:
How do you set versions?
0
 
Sjef BosmanGroupware ConsultantCommented:
Notes versioning is a means to save ALL versions of a document. Different versions of a document are stored as a response hierarchy. Versioning can be done in three ways: when a document is saved, the modified document will be the parent of the existing document, or the child, or a sibling (with the same parent). On the Form Properties, first tab, see Versions and Versioning. Advantage: you'll never lose a version. Disadvantage: you'll never lose a version. For every small change and save of a document, a new document is created. You need some clever mechanism to prune your hierarchy, i.e. to remove useless intermediate documents.
0
 
schmad01Author Commented:
Suppose I just wanted to make a copy of a form, call it a different name then the original. How would I make a copy of a document to the same database using the new form? Maybe this is the way I want to do it?  I don't want responses or siblings, just a new copy.
0
 
Sjef BosmanGroupware ConsultantCommented:
A new copy, with a different form name in it?

Button "Copy to Different form":

    Dim ns As New NotesSession
    Dim db As NotesDatabase
    Dim dc As NotesDocumentCollection
    Dim doc As NotesDocument
    Dim newdoc As NotesDocument

    Set db= ns.CurrentDatabase
    Set dc= db.UnprocessedDocuments
    Set doc= dc.GetFirstDocument
    Do Until doc Is Nothing
        Set newdoc= doc.CopyToDatabase(db)
        newdoc.Form= "Different"
        Call newdoc.Save(True, False)
        Set doc= dc.GetNextDocument(doc)
    Loop

or something very close to this code...
   
0
 
schmad01Author Commented:
At the same time I want to set the field "release" to "Yes".  Can you add that in there?
0
 
schmad01Author Commented:
Sorry, I wasn't clear. I want to set the field in the different form called "release" to "Yes".
0
 
schmad01Author Commented:
Yes, I was getting a little lazy.  That's it! Thanks, sjef.
0
 
Sjef BosmanGroupware ConsultantCommented:
:-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.