Skip to main content
This forum is closed to new posts and responses. New discussions are now taking place in the IBM Developer Answers forum.
 
developerWorks
AIX and UNIX
Information Mgmt
Lotus
New to Lotus
Products
How to buy
Downloads
Live demos
Technical library
Training
Support
Forums & community
Events
Rational
Tivoli
WebSphere
Java™ technology
Linux
Open source
SOA and Web services
Web development
XML
My developerWorks
About dW
Submit content
Feedback



developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum

developerWorks

  

PreviousPrevious NextNext


kgaurav gulati 3.Apr.07 06:24 AM a Web browser
Domino Designer 6.0.3 Windows 2000


Hi

I have an agent which is fetching data from oracle database and populating it into notesdatabase. But it is giving error

4000: Notes error: You cannot update or delete the document(s) since you are not listed as an allowable Author for this document.

It populates 2 document then it gives error and agent stops.

What is the cause?

Agent Code:

On Error Goto halt
Dim s As New notessession
Dim db, db1 As notesdatabase
Dim doc As notesdocument
Dim doc1 As notesdocument
Dim doc2 As notesdocument
Dim doc3 As notesdocument
Dim view As notesview
Dim view1 As notesview
Dim view2 As notesview
Dim collection As NotesViewEntryCollection
Dim entry As NotesViewEntry
Dim dc As notesdocumentcollection
Dim dt, dt1 As notesdatetime
Dim item As notesitem

Set db=s.CurrentDatabase
Set doc=s.DocumentContext
Set view=db.GetView("ProjectMaster")

'Set collection = view.AllEntries
'Set entry = collection.GetFirstEntry()
'While Not(entry Is Nothing)
' Set doc1 = entry.Document
' doc1.Remove(True)
' Set entry = collection.GetNextEntry(entry)
'Wend


pi_code=doc.empcode(0)
'pi_code="1095"

Set collection=view.getallentriesbykey(pi_code)
If Not(collection Is Nothing) Then
Call collection.RemoveAll(True)
End If

Set db1=s.GetDatabase("kmteri/teri", "names.nsf")
Set view2=db1.getview("CVBuilderUsers")
Set doc3=view2.GetDocumentByKey(pi_code)
username=Lcase(doc3.FullName(0))

Dim con As New odbcconnection()
Dim qry As New odbcquery()
Dim res As New odbcresultset()
Set qry.connection = con
Set res.query = qry
flag = con.connectto("ERP","erpdev","qw#er5ty")
'Print(flag)
'pi_code=doc.empcode(0)
msg1="select distinct a.project_code project_code, h.SECTOR_DESC sector, a.project_title project_title, a.SANCTION_DATE sanction_date, a.PROJECT_START project_start, a.COMPLETION_DATE completion_date, a.PROJECT_END project_end, a.OBJECTIVE OBJECTIVE,'PI' MEMBER_ROLE ,c.ORGANISATION_NAME organisation "
msg2="from project_master a,PROJECT_CONTACTS b,PROJECT_CONTACT_DETAILS c, project_sector h where a.project_code=b.project_code(+) "
msg3="and b.PROJ_CONTACT_CODE=c.CONTACT_CODE(+) and a.project_code=h.project_code(+) and a.project_code not like 'TMP%' and a.pi_code='"+pi_code+"' "
msg4="union select distinct e.project_code project_code, i.SECTOR_DESC sector, d.project_title project_title,d.SANCTION_DATE sanction_date, d.PROJECT_START project_start,d.COMPLETION_DATE completion_date, d.PROJECT_END project_end, d.OBJECTIVE objective, decode(team_member_type,'A', 'External Advisor', 'E', 'External Peer Reviewer', 'R', 'Internal Peer Reviewer', 'S', 'Service Area', 'I', 'Internal Advisor', 'M','Team Member') MEMBER_ROLE, "
msg5="AGG_STRING(g.ORGANISATION_NAME) organisation from project_master d,project_teammembers e,PROJECT_CONTACTS f,PROJECT_CONTACT_DETAILS g, project_sector i where d.project_code=e.project_code(+) "
msg6="and e.project_code=f.project_code(+) and d.project_code=i.project_code(+) and f.PROJ_CONTACT_CODE=g.CONTACT_CODE(+) and e.project_code not like 'TMP%' "
msg7="and e.empcode='"+pi_code+"' group by e.project_code,i.SECTOR_DESC, d.project_title,d.SANCTION_DATE, d.PROJECT_START,d.COMPLETION_DATE , d.PROJECT_END, d.OBJECTIVE, "
msg8="decode(team_member_type,'A', 'External Advisor', 'E', 'External Peer Reviewer', 'R', 'Internal Peer Reviewer', 'S', 'Service Area', 'I', 'Internal Advisor', 'M','Team Member') order by project_code, MEMBER_ROLE "

qry.SQL=msg1+msg2+msg3+msg4+msg5+msg6+msg7+msg8

res.execute

If res.IsResultSetAvailable() = True Then

Do
res.nextrow
If res.isvaluenull("project_code") Then
project_code=""
Else
project_code = res.getvalue("project_code",project_code)
End If
If res.isvaluenull("sector") Then
sector=""
Else
sector = res.getvalue("sector",sector)
End If
If res.isvaluenull("PROJECT_TITLE") Then
PROJECT_TITLE=""
Else
PROJECT_TITLE = res.getvalue("PROJECT_TITLE",PROJECT_TITLE)
End If
If res.isvaluenull("SANCTION_DATE") Then
SANCTION_DATE=""
Else
SANCTION_DATE = res.getvalue("SANCTION_DATE",SANCTION_DATE)
End If
If res.isvaluenull("PROJECT_START") Then
PROJECT_START=""
Else
PROJECT_START = res.getvalue("PROJECT_START",PROJECT_START)
End If
If res.isvaluenull("COMPLETION_DATE") Then
COMPLETION_DATE = res.getvalue("PROJECT_END",PROJECT_END)
Else
COMPLETION_DATE = res.getvalue("COMPLETION_DATE",COMPLETION_DATE)
End If
If res.isvaluenull("member_role") Then
member_role=""
Else
member_role = res.getvalue("member_role",member_role)
End If
If res.isvaluenull("ORGANISATION") Then
ORGANISATION=""
Else
ORGANISATION= res.getvalue("ORGANISATION",ORGANISATION)
End If
If res.isvaluenull("OBJECTIVE") Then
OBJECTIVE=""
Else
OBJECTIVE= res.getvalue("OBJECTIVE",OBJECTIVE)
End If

'Set dt=New NotesDateTime(project_start)
'Set dt1=New NotesDateTime(completion_date)

'diff=dt1.timedifference(dt) / 86400

'If diff=0 Then
' diff=""
'Else
' diff=Cstr(diff) +" Days"
'End If


tvar2 = Cstr(sector)
tvar3 = Cstr(PROJECT_TITLE)
tvar4 = Cstr(SANCTION_DATE)
tvar5 = Cstr(PROJECT_START)
tvar6 = Cstr(Format(Cdat(COMPLETION_DATE), "dd-MMM-yyyy"))
tvar7 = Cstr(member_role)
tvar8 = Cstr(ORGANISATION)
tvar9 = Cstr(OBJECTIVE)
tvar10=Cstr(pi_code)
tvar1 = Cstr(project_code)

Set view1=db.GetView("ProjectMasterProjectCode")

'Call view.Refresh
Call view1.Refresh
Set doc2=view1.GetDocumentByKey(tvar1, True)


If (doc2 Is Nothing) Then
Set newdoc = db.createdocument
newdoc.form="ProjectMaster"
Principle =username
newdoc.Principal = Principle
newdoc.From = Principal
newdoc.AltFrom = Principle
newdoc.SendFrom = Principle
newdoc.INetFrom = Principle
newdoc.tmpDisplaySentBy = Principle
newdoc.tmpDisplayFrom_Preview = Principle
newdoc.DisplaySent = Principle
'newdoc.expertise=tvar2
newdoc.project_code=tvar1
newdoc.project_name=tvar3
newdoc.role=tvar7
newdoc.comments=tvar9
newdoc.location=tvar8
newdoc.project_year=tvar6
newdoc.timespent_project=diff
newdoc.pi_code=tvar10
newdoc.username=username
Set item=newdoc.appenditemvalue("Authors", username)
item.IsAuthors=True
Call newdoc.save(True,True)
'Call view.refresh
Call view1.refresh
%REM
Elseif Not (doc2 Is Nothing) And (doc2.username<>username) Then
Set newdoc = db.createdocument
newdoc.form="ProjectMaster"
Principle =username
newdoc.Principal = Principle
newdoc.From = Principal
newdoc.AltFrom = Principle
newdoc.SendFrom = Principle
newdoc.INetFrom = Principle
newdoc.tmpDisplaySentBy = Principle
newdoc.tmpDisplayFrom_Preview = Principle
newdoc.DisplaySent = Principle
'newdoc.expertise=tvar2
newdoc.project_code=tvar1
newdoc.project_name=tvar3
newdoc.role=tvar7
newdoc.comments=tvar9
newdoc.location=tvar8
newdoc.project_year=tvar6
newdoc.timespent_project=diff
newdoc.pi_code=tvar10
newdoc.username=username
Set item=newdoc.appenditemvalue("Authors", username)
item.IsAuthors=True
Call newdoc.save(True,True)
'Call view.refresh
Call view1.refresh
%END REM
Else
If doc2.role(0)<>tvar7 Then
doc2.role=doc2.role(0) +" / " +tvar7
Call doc2.save(True,True)
End If
End If

Set newdoc= Nothing
Set doc2 = Nothing
Set item=Nothing
'Set view1=Nothing
tvar1 = empty
tvar2 = empty
tvar3 = empty
tvar4 = empty
tvar5 = empty
tvar6 = empty
tvar7 = empty
tvar8 = empty
tvar9 = empty
tvar10=empty
Principle=empty
'Call view1.clear

Loop Until res.isendofdata


End If
halt:
Set newdoc = db.createdocument
newdoc.form="ProjectMaster"
newdoc.project_code=tvar1
newdoc.project_name="B"
newdoc.role="C"
newdoc.comments="D"
newdoc.location="E"
newdoc.project_year="F"
newdoc.timespent_project=Str(Err) & ": " & Error$
newdoc.pi_code="G"
Call newdoc.save(True,True)






Notes error 4000 (kgaurav gulati 3.Apr.07)
. . RE: Notes error 4000 (Kee Keekkenen 3.Apr.07)
. . . . RE: Notes error 4000 (kgaurav gulati 4.Apr.07)
. . . . . . RE: Notes error 4000 (Kee Keekkenen 4.Apr.07)





  Document options
Print this pagePrint this page

 Search this forum

  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Author
Category
Platform
Release
Advanced search

 RSS feedsRSS
All forum posts RSS
All main topics RSS
More Lotus RSS feeds

Resources

 Resources
Forum use and etiquette
Native Notes Access
Web site Feedback

Lotus Support

 Lotus Support
IBM Support Portal - Lotus software
Lotus Support documents
Lotus support by product
Lotus support downloads
Lotus support RSS feeds

Wikis

 Wikis
IBM Composite Applications
IBM Mashup Center
IBM Connections
IBM Connections Cloud Developers
IBM Docs
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud for Social Business
IBM Web Experience Factory
Lotus Domino
Lotus Domino Designer
Lotus Expeditor
Lotus Foundations
Lotus iNotes
Lotus Instructor Community Courseware
Lotus Notes
Lotus Notes & Domino Application Development
Lotus Notes Traveler
Lotus Protector
Lotus Quickr
Lotus Symphony
IBM Web Content Manager
WebSphere Portal

Lotus Forums


 Lotus Forums
Notes/Domino 9.0
Notes/Domino 8.5 + Traveler
Notes/Domino XPages development forum
Notes/Domino 8
Notes/Domino 6 and 7
IBM Connections
IBM Mobile Connect
IBM Sametime
IBM SmartCloud Notes
Lotus Enterprise Integration
Lotus Protector
Lotus Quickr
Lotus SmartSuite