shuboarder
asked on
Create Documents In A View Agent Based On Another View's Documents And Status
Hi all,
it's been a while....
I need an agent that will create documents in a view on a daily basis.
I want this agent to look at another view (lets call it view1) and collect all names with a status of "Active"
Then, create (in view2) new documents with today's date for each of these names.
i.e. view 1:
Name Status
Smith Active
Jones Not
Campbell Active
On daily basis agent looks at view 1 and should create in view 2:
Date Name Details
18/05/06 Smith
18/05/06 Campbell
Thanks for your help!
it's been a while....
I need an agent that will create documents in a view on a daily basis.
I want this agent to look at another view (lets call it view1) and collect all names with a status of "Active"
Then, create (in view2) new documents with today's date for each of these names.
i.e. view 1:
Name Status
Smith Active
Jones Not
Campbell Active
On daily basis agent looks at view 1 and should create in view 2:
Date Name Details
18/05/06 Smith
18/05/06 Campbell
Thanks for your help!
Why do you need documents to be created? Since the view could contain the same documents as in the other view, but only the Active ones?
Hmm those Q details have changed completely .....
ASKER
I need to record details on a daily basis for each active employee.
Which employees are active can change on a daily basis.
I don't see how this can be done in any other way than I set out in my original question.
Which employees are active can change on a daily basis.
I don't see how this can be done in any other way than I set out in my original question.
Two alternatives:
- log the status changes in a log record document, with date and time, e.g.
Dirt. E. Harry, 1-1-2006, Active
Dirt. E. Harry, 1-1-2006, Inactive
with some relational lookup you can find out what he did on a certain date
- log those changes in the user's document itself, in one or more multi-value fields
- log the status changes in a log record document, with date and time, e.g.
Dirt. E. Harry, 1-1-2006, Active
Dirt. E. Harry, 1-1-2006, Inactive
with some relational lookup you can find out what he did on a certain date
- log those changes in the user's document itself, in one or more multi-value fields
ASKER
Either I'm not understanding, or you're not quite with me....?
View 2:
Date (Categorised) Name Today's Details
The view has to have the above structure. i.e. need to see individual document per day per active employee
The Today's details column is edited directly in the view
However at present this view lists all employees and requires each employee document to be created every day.
I would like employee documents to be created automatically only for the employees that at the time the agent runs are active.
Don't know if that helps?
View 2:
Date (Categorised) Name Today's Details
The view has to have the above structure. i.e. need to see individual document per day per active employee
The Today's details column is edited directly in the view
However at present this view lists all employees and requires each employee document to be created every day.
I would like employee documents to be created automatically only for the employees that at the time the agent runs are active.
Don't know if that helps?
Ah understand.
A scheduled agent, running early in the morning, with target None:
Dim ns As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim newdoc As NotesDocument
Set db= ns.CurrentDatabase
Set view= db.GetView("SomeViewThatSh owsOnlyAct iveUsers")
Set doc= view.GetFirstDocument
Do Until doc Is Nothing
Set newdoc= New NotesDocument(db)
Call newdoc.ReplaceItemValue("F orm", "TheFormnameYouWant")
Call newdoc.ReplaceItemValue("D ate", Today)
Call newdoc.ReplaceItemValue("N ame", doc.Name)
Call newdoc.ReplaceItemValue("D etails", "")
Call newdoc.Save(True, False)
Set doc= view.GetNextDocument(doc)
Loop
A scheduled agent, running early in the morning, with target None:
Dim ns As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim newdoc As NotesDocument
Set db= ns.CurrentDatabase
Set view= db.GetView("SomeViewThatSh
Set doc= view.GetFirstDocument
Do Until doc Is Nothing
Set newdoc= New NotesDocument(db)
Call newdoc.ReplaceItemValue("F
Call newdoc.ReplaceItemValue("D
Call newdoc.ReplaceItemValue("N
Call newdoc.ReplaceItemValue("D
Call newdoc.Save(True, False)
Set doc= view.GetNextDocument(doc)
Loop
ASKER
Ok,
it's nearly there.
It creates the documents in the correct view, but creates thousands.
How/where do I specify to only create documents for "active" employees?
I tried this in the document selection for the agent but this seemed to make things worse.
it's nearly there.
It creates the documents in the correct view, but creates thousands.
How/where do I specify to only create documents for "active" employees?
I tried this in the document selection for the agent but this seemed to make things worse.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Still no luck....
Now it is not creating anything.
If it helps it needs to look at view1 >> pick all "active" employees
create records for these in view2.
I have a view that displays all users. no one which displays only active users.
Would it be easier to create a hidden view only displaying active users?
Or is it not too difficult to write this into the agent?
Now it is not creating anything.
If it helps it needs to look at view1 >> pick all "active" employees
create records for these in view2.
I have a view that displays all users. no one which displays only active users.
Would it be easier to create a hidden view only displaying active users?
Or is it not too difficult to write this into the agent?
ASKER
Strange.... they've just appeared! about 15 minutes after the agent ran?
Weird... F9 to refresh the view?
ASKER
Yeah, I tried the F9 immediately. Also shut notes down and restarted - they just appeared like 15 minutes later
When it's a scheduled agent, it doesn't necessarily run immediately. Domino decides when to run it.
ASKER
ok, seems to be working ok...
Thanks for your help as always!
Thanks for your help as always!
select form="myform" & someothercondition="someth
and maybe sort / categorise view 2 differently and add your details field as another column.
Can you elaborate a bit more?
Steve