AllExperts > Experts 
Search      

Using Lotus Notes

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More Using Lotus Notes Answers
Question Library

Ask a question about Using Lotus Notes
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Paski K. Paskaradevan
Expertise
I have 3 + years in Lotus Notes application development. I am a CLP R5 Application Development. I can answer any question pertaining to application development.

Experience
R5 CLP. In addition, I have a bachelors degree in Engineering and a MBA.
 
   

You are here:  Experts > Internet/Online > Email > Using Lotus Notes > lotus notes agent

Topic: Using Lotus Notes



Expert: Paski K. Paskaradevan
Date: 6/2/2008
Subject: lotus notes agent

Question
hi...i m new with notes...i hav prepared a notes agent which assigns ID numbers....i hav a form which takes names(Editable,Text),address(Editable,Text) n the mintue of creation(Editable,Text) and a view which displays the name, address n the generated id
The form contains a hotspot(Register) which must run the agent on being clicked.......i tried 2 do a web query save statement but its not workin...
the agent is as follows....
Sub Initialize
  'inserted on 30 may'08- TANUSHREE
  'this code generates a unique identification number usin the emp database and the emp name.
  
  'declarations
  Dim session1 As New NotesSession
  Dim tmpdb1 As NotesDatabase
  Dim tmpview1 As NotesView
  Dim tmpdoc1 As NotesDocument
  Dim tmpID1 As String
  Dim tmpemp_Name As String
  Dim tmp_Minute As String
  
  'error handling statement
  On Error Goto ErrProc
  
  
  'initializations
  Set tmpdb1=session1.CurrentDatabase
  'obtaining the employee data view
  Set tmpview1 =tmpdb1.GetView("Register_view")
  'setting the handle for the first doc in the view
  Set tmpdoc1 =tmpview1.GetFirstDocument
  'initializing the counters to zero
  tmpemp_Name=" "
  tmp_Minute=" "
  tmpID1=" "
  
  
  
  'while loop is used so that the code iterates through all the docs in the view
  'While Not (tmpdoc1 Is Nothing)
  If tmpdoc1.fld_Name(0) Like "TANUSHREE" Then
     Msgbox " such name exists"
     'getting the emp name
     tmpemp_Name= tmpdoc1.fld_Name(0)
     'getting the minute of creation
     tmp_Minute=tmpdoc1.fld_time(0)      
     'generating the unique ID
     tmpID1=tmpemp_Name+ "_" +tmp_Minute
  Else
     Msgbox "No such name exists"
  End If
     'setting the handle for the next doc in the view
     'Set tmpDoc1 = tmpView1.GetNextDocument(tmpDoc1)   
  'Wend
  
     'displaying the output to the user
  Msgbox  " The Unique ID Is :  "+tmpID1
  
  Exit Sub   
  
  'error handling section
ErrProc:
  Msgbox "Agent assign_ID_Numbers --> Erreur : Ligne("& Str$(Erl()) &") Err : " & Str(Err) & " - " & Error$
  Print "Agent assign_ID_Numbers --> Erreur : Ligne("& Str$(Erl()) &") Err : " & Str(Err) & " - " & Error$   
  Exit Sub
  
  
End Sub

m problem is that i dont know how to run it...
plz tell me how to connect the agent to the view...  

Answer
Hi,

Is this form being used on the web (intranet/internet) or in the notes client?

If you are writing this in the web query save agent, I am assuming that it is working on the web. Which means that your Register hot spot is saving the form on the web.

Once you do that, the web query save agent runs. In this case, you cannot show the out put to the user using a message box method.

On the other hand, if your users are doing this in the notes client, you should put this code in the query save event of the form and the Register hot spot should save the document. Or put this code in the register hot spot.

Your code looks ok as you have written. It needs to be debugged to fix any errors. But you cannot debug if it is a web based form.

So, please let me know if this is done on the web or notes client.

I am also a bit confused since you want to generate id but here you are finding the id and trying to display it. So, let me know exactly what you want to do.

Thanks and regards.

Paski  

Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.