Solved

Webquery Save Agent Alternative

Posted on 2004-08-09
20
483 Views
Last Modified: 2013-12-18
Hi,

I've two forms. One is for web and one is for Notes. Both have the same field names and same fields.  When the web form is saved it is also saved in Notes. Now the question is I'm running a webquery save agent.
This webquery save agent does lot of processing as it reads some fields from the webforms and updates other documents in the database. I've a particular field in the webform which can really have large number of values (Multiple Values). When there are large number of values in this field it is taking lot of time after clicking the submit button to process as the webquery agent should read all those fields. In this case the user will have to wait for a long time to see the next screen which gives the confirmation. The reason is the webquery agent is running in the background.  

Is there any way I can run this webquery agent later after fully submitting the form. Or can I run this agent in the Notes form (like in query save or some where else)...


Please advise and let me know if I'm not clear.
thanks
Kalios
0
Comment
Question by:kalios
  • 7
  • 6
  • 5
  • +2
20 Comments
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 11752733
Most agent activity is on server (i.e. background).. So I am not sure why or where you are seeing the delay.

~Hemanth
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 11752790
You'll certainly notice the delay, for the agent runs "real-time". There are two options:
1. you add a field to the document, stating that it needs post-processing; you create an agent that processes the yet unprocessed documents
2. you trigger a second agent from the WQS agent; keep in mind that the document is NOT saved yet, so the second agent shouldn't run within a second

I prefer the first method, but only if the updates to be done can be postponed 15 minutes or so, because nobody needs them
0
 
LVL 15

Assisted Solution

by:Bozzie4
Bozzie4 earned 20 total points
ID: 11752810
Actually, you can see a delay, if you haven't enabled "Run web agents concurrently?" in the server document.

So enable this setting and check if performance is better.  There is btw hardly any difference in running the wqs agent, and processing formulas (agent will be a lot slower, but this should not be hardly noticeable in web apps).  Formula's run in the background (on server) too, although they can by default "run concurrently"


cheers,

Tom
0
 
LVL 15

Expert Comment

by:Bozzie4
ID: 11752859
And if the form has a lot of fields, maybe your delay is caused by the huge amount of data you upload to the server  ?

There are some solutions to this as well:
Use 2 WebQuerySave agents.  In the first, use print statements to return a message like "Please wait".  Put actual processing in the second.  Don't call the 2nd from the first, though, like Sjef says, because you won't gain anything.  Just do
@command([toolsrunmacro];"WQS1");
@command([toolsrunmacro];"WQS2")

cheers,

Tom
0
 
LVL 2

Author Comment

by:kalios
ID: 11752866
I've a $$return field in the form. So when I submit the form it will redirect me to the link specified.
However, there is a lot of delay after I click the submit button. It tries to run the webquerysave agent.
The page just sits like that for a while (sometimes even 15 minutes depending upon the fields in the big multi-value field).  

It looks like the $$return is waiting for the webquerysaveagent to finish processing.

0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 11752976
15 minutes?! That's not very user-friendly...

I assume you tested with and without the WQS-agent, and that running without completes within a few seconds. I have several applications with PostProcessing-agents, all without a glitch. The agent is triggered automatically on "When documents are added or modified", and it is sometimes necessary to set the trigger to appear more frequently (e.g. every 15 minutes. The second advantage of this approach is that you can handle the PostProcessing of multiple updated documents.

Eh, if  may ask: what the h*ll takes 15 minutes to process?? It might be worthwhile to put another question inhere to speed up your algorithm.
0
 
LVL 15

Expert Comment

by:Bozzie4
ID: 11752982
I have to sadly admit that my 2 wqs agents approach does not work.  It processes them both, but only returns a result from the second ....  Same result as  calling 2nd from first agent (sorry sjef:-) ).

WQS takes precedence over $$Return - so, yes you will have to wait till your agents finishes.

Another option is to launch a second window (using javascript) when submitting, or to simply open a new page when submitting, or to direct your submitted form somewhere else.  That way you can still ask the user for some patience :-)


Have you already checked the "run agents concurrently" setting ?



0
 
LVL 2

Author Comment

by:kalios
ID: 11753080
I did not check run agents concurrently. I'll try to do that... I'm going to put another question and will put my code in there and lets see it can be improved. Just like the webquery save agent can I have something in notes form that will run an agent as soon as a document i saved.



thanks
Kalios
0
 
LVL 15

Expert Comment

by:Bozzie4
ID: 11753131
Yes, that's what Sjef is trying to tell you.  You will have a delay of (standard) 5 to 10 minutes, but there are notes.ini settings you can set to adjust this delay down to 1 minute....
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 11753151
The first I knew (2 wqs agents will run sequentially and real-time), the second I did know (calling the second agent) but I always think again that "triggering" is an a-synchronous operation and therefore it isn't the same as "calling". Wrong again.

I'd say, since all other options are more or less makeshift and will lead to poor quality solutions, go for the PostProcessing. Think very carefully what has to be done NOW (validations, computations that are shown on the screen, etc), and what can be done LATER (mails, updates of other documents, etc)
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 11753234
Sorry Tom, the default for AMgr_DocUpdateAgentMinInterval is 30 minutes. At least that's what the Admin Help says.
0
 
LVL 2

Author Comment

by:kalios
ID: 11753435
Hi,
I've put another question with the code. Also can you please be a little more clear about post processing.
Where do i call the agent in post processing

thanks
kalios
0
 
LVL 15

Expert Comment

by:Bozzie4
ID: 11753497
That's possible too :-)

I probalby got them mixed up (there is 1 parameter that defaults to 5, I am sure !)

cheers,

Tom
0
 
LVL 31

Assisted Solution

by:qwaletee
qwaletee earned 20 total points
ID: 11753649
PostProcesisng that everyone is refering to means don't use a WebQuerySave agent.  Instead, put ALMOST the same code into an agent set to run "when documents are added to updated in the database."  Notes will wkae this agent up periodically when there are new documents or updated documents.  It can then use db.unprocessedDocuments to get the list of documents that need to be processed, and session.updateProcessedDoc to remove the doc form teh processing queue.

The user never "sees" the agent running (good), but the agent does not run immediately (bad).
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 11753691
You don't call the agent! It will be called automatically, if you set the agent to be triggered "When documents are added or modified". As soon as the server thinks it has time, the agent is started. I normally create a simple view that matches only the documents that need postprocessing. The agent should walk though these documents and do whatever is necessary.
0
 
LVL 2

Author Comment

by:kalios
ID: 11754309
Sjef,

Thanx for the explanation. I guess though there will be a little delay in the updates, I guess this would solve my problem. I would like to go with the post processing approach.  

I can select the post processing agent with target as "when documents are added or updated in the database".

But I only want to run this agent for new documents that are created for form "PortalAD". How is it possible.
How do I specify it in the code ?

If you see I've put another question subject: Improve Code for better performance
I want to run that code here..

thanks much
Kalios
0
 
LVL 2

Author Comment

by:kalios
ID: 11754341
"I normally create a simple view that matches only the documents that need postprocessing. The agent should walk though these documents and do whatever is necessary".  
I can create a view which matches my criteria and that should effect the agent.
How does the agent walk through these documents only?

thanks
Kalios




0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 11754504
As I suggested, add one field to the document when saved, called PostProcessing, and set it to "1". The view can just contain the select-statement
    SELECT PostProcess<>""
Your agent will then open that view, handle each document that's in there and finally it will remove the item PostProcess. Only new documents will be handled, since existing documents will never appear in the View.
0
 
LVL 2

Author Comment

by:kalios
ID: 11755043
yes, thanks again.
Can you please give me a sample code on how to read documents from a particular view and process them.
0
 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 20 total points
ID: 11755288
Sample code? Well, here you go, untested as usual:

Dim ns As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim nextdoc as NotesDocument
Dim view As NotesView

Set db= ns.Database
Set view= db.GetView("yournewview")
Set doc= view.GetFirstDocument
Do Until doc Is Nothing
    Set nextdoc= view.GetNextDocument(doc)
.....processing
    Call doc.RemoveItem("PostProcessing")
    Call doc.Save(True,False)
    Set doc= nextdoc
Loop
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
HP DP 7.03 and lotus collaboration suite 9 3 144
Domino not switching to TLS 1.0 4 758
Lotus notes email code 2 113
@Mailsend 3 20
I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

707 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now