Solved

Formula Agent

Posted on 2007-03-19
5
257 Views
Last Modified: 2013-11-17
Hi All,

I have a couple of fields called questions and questionNo in a form called Extra Questions.

The questionNo display the number of the question and the questions field displays the question. The user can create more than one questions.

However I have a large number of records with the following:

Example 1
QuestionNo      Questions
1                  How old are you?
2                  Gender
3                  Date of Birth
4                  Question

Example 2
QuestionNo      Questions
1                  Question

I would like to remove question 4 from above but leave questions 1 to 3 in example 1 but I'm not able to do this.

In example 2 I created an agent to remove the question. The agent is a simple formula agent:
Field Questions := "";
and it works great.

I'm having difficulties with removing question 4 in example 1.

Can anyone help with this problem? I'm not sure how to remove question 4 in example 1. I would like to use a formula agent because they are easy to understand.

Thanks.
0
Comment
Question by:jose11au
  • 2
5 Comments
 
LVL 19

Accepted Solution

by:
madheeswar earned 500 total points
ID: 18748126
Dim session As New NotesSession
 Dim db As NotesDatabase

dim view as notesview
Dim doc As NotesDocument

 Set db = session.CurrentDatabase
 Set view= db.getview("YourViewName")
 Set doc = view.GetfirstDocument
while not doc is nothing
 If doc.HasItem( "Question4" ) Then
 Call doc.RemoveItem( "Question4" )
call doc.save(true,true)
end if
set doc=view.getnextdocument(doc)
wend
0
 

Author Comment

by:jose11au
ID: 18754280
Hi madheeswar,

Thanks for your response. The above didn't work, do you another suggestion.

Thanks for your help.
0
 
LVL 19

Expert Comment

by:madheeswar
ID: 18754361
Place the code in the Agent and make it to run on all the documents in the view.

Now, from the actions menu, try to run the agent. Also, debug if it is giving any errors.
You have to give your View name and Field name in my code. if you place the code as it is, it won't work.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Capture Serial Data in Lotus Notes Database 8 269
Send email and attachment (Lotus notes) 55 248
Lotus notes email code 13 95
Save conflict messages on existing documents 15 74
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question