• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 196
  • Last Modified:

copying document to a separate DB

Hi Experts,
I have a good question for you. Could you please help me, How to copy a document to a separate database by pressing a single button from the web client before deleting the document permanently.
0
skancherla
Asked:
skancherla
  • 3
  • 2
  • 2
  • +1
1 Solution
 
stharrisCommented:
skancherla,

This is a rather complicated process, and if you want of the Developers (not me) in this forum to help you out you might want to increase the point.....alot.

St. Harris
0
 
stharrisCommented:
Oops, that was supposed to say Points (not point).  9 'Points' is considered ultra easy!

St. Harris
0
 
snocrossCommented:
1) Have the button set a field on the document:
@SetField("DeleteThis"="Y");@Command([FileSave]);@Command([FileCloseWindow])

2) Create a view called 'Archives'
In the view selection formula put:

DeleteThis = "Y"

3) In the WebQuerySave event call an archive agent

@Command([ToolsRunMacro];"ArchiveAndDelete")

Here's the ArchiveAndDelete agent:

     Dim session As New NotesSession
     Dim db As NotesDatabase
     Dim view As Notesview
     Dim doc As Notesdocument    
     Dim archiveDb As New NotesDatabase( "server1/Acme company", "Web\archdb.nsf" )    
     Set db = session.CurrentDatabase
     Set view = db.GetView("Archives")
     Set doc = view.GetFirstDocument
     
     While Not(doc Is Nothing)
          Call doc.CopyToDatabase( archiveDb )      
          doc.Remove(True)        
          Set doc = view.GetFirstDocument
          REM Set doc = view.GetNextDocument(doc)
     Wend  
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
ArunkumarCommented:
Hi Sanjay !!!

Welcome to EE !
Where are you ?  Send me your contact numbers da.  I called up your old number and heard that you have moved to Chicago !  Is that so ?

Keep me updated...

:)
Arun
0
 
skancherlaAuthor Commented:
I followed all your instructions and copied your code in the agent and when i tryied to delete the document from the web client, you know it is making a copy in the archive database, thats fantastic!, but after copying it is not deleting the document from the original DB. In the Agent, after making a copy to the Archive DB, i have written the code as Call doc.remove(True). It has to delete the document but it is not deleting. i also checked that i have the manager access to the database with Delete documents option checked.
0
 
snocrossCommented:
Hmmm... it sounds like the document is not fully closed before it's trying to delete it.  In other words it's executing the FileCloseWindow after the WebQuerySave event gets kicked off.  It can't delete it because you still are in it.  Perhaps you could do this:

1) create a new form called DeleteConfirm that contains the following text:  "THE DOCUMENT HAS SUCCESSFULLY BEEN DELETED".  

2) Remove the WebQuerySave event code from your original form

3) Add the code (the @Command([ToolsRunMacro])) to the WebQueryOpen event on the DeleteConfirm form.

4) Change your button so that after you do your @setfield, @FileSave and @FileCloseWindow you open up the new confirmation form.
0
 
skancherlaAuthor Commented:
it worked! you have helped me at the right time. Thanks very much. Your help is more than appreciation.
0
 
skancherlaAuthor Commented:
snocross,
I accepted your answer, marked excellent, i gave you 9 points. Did you get it? For me it tells that you have got 0 points though i gave 9 points to you. please let me know how much u got.

you seems to be genius, can i have your email id? i would like to chat with you.

0
 
ArunkumarCommented:
Hi Sanjay !!!

When you give less than 10 points for a question then 10% of that would be nothing for any person who reads that answer(Anyone can read the answer for free).  

But the excellent grading will give the expert of 9 multiplied by 4 times.  

OK ?  

What happened to my reply to you did you receive it or not ?  Anyway i will call you today at your office da...

-Arun
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now