Trouble debugging web agent

Hi All

I need to debug a web agent

I have tried using Print statements, however it does not seem to working

Any ideas or hints

thanx a bunch

James
imjameswAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

p_parthaCommented:
Print statements are returned as the output to the browser when the document is submitted through javascript (document.forms[0].submit() and not through formula @command([filesave])

if you want to debug through the log, then use msgbox, This will print the values in the log file

Partha
0
imjameswAuthor Commented:
I am using lotusscript called via WebQuerySave

@Command([ToolsRunMacro]; "agtWebCancellationSave")
0
p_parthaCommented:
Oh there are lot of things you ahve to tell me:

First Does your agent has run once @commands may be used as the option on which documents it should act on

when you say you are calling webquerysave , how are you doing it. Are you submitting the page using document.forms[0].submit() or @command([filesave])

partha
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

p_parthaCommented:
Probably there are errors in the agent also , check the log file or give the print statement as teh first line in your agent

Partha
0
imjameswAuthor Commented:
run once @commands may be used =Yes

Using a coded submit button on the form

//before submitting this form, validate and add this session to the user's calendar.
frm=window.document.forms[0];
if (validate(frm.NWIDTX))
{
      frm.submit();
}
0
p_parthaCommented:
Just to verify do all this:


frm=window.document.forms[0];
if (validate(frm.NWIDTX))
{
alert('submitting')

     frm.submit();
}

and in your agent the first line is :

Print "coming inside the agent"

also check your log file
0
imjameswAuthor Commented:
Ok

so I got a msgbox popup saying submitting
and coming inside the agent on a page in the browser
0
imjameswAuthor Commented:
12/01/2004 02:30:02 PM  Agent '(WebCancellationSave) | agtWebCancellationSave' error: Object variable not set
0
p_parthaCommented:
Yeah there is a error do one thing:

first line in your agent:

On error goto par

last line in your agent
exit sub
Print "Error occurred on line number" & erl & " errror is " & error
exit sub
0
p_parthaCommented:
Typo:

On error goto par

last line in your agent
exit sub
Par:
Print "Error occurred on line number" & erl & " errror is " & error
exit sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
imjameswAuthor Commented:
Error occurred on line number87 errror is Object variable not set
0
HemanthaKumarCommented:
log.nsf records the error msgs..that is ur best bet

~Hemanth
0
p_parthaCommented:
It's tough to explain to you what might be the problem , paste the 87th line alone.. i will try to explain

partha
0
imjameswAuthor Commented:
I have found that problem

It was looking to a non existent html paage      
0
imjameswAuthor Commented:
Error occurred on line number0 errror is
0
p_parthaCommented:
Good ! it;s always better to have on error and print statements :)

Partha
0
p_parthaCommented:
YOu need ot have a exit sub above your error Label statement

partha
0
imjameswAuthor Commented:
Now I need to put print statments in the agent

strFirstName = docCancel.RFirstName(0)
strLastName = docCancel.RLastName(0)
strCourseName = docCancel.RCourseName(0)
strSessionDate = docCancel.SessionDate(0)
strSessionTime = docCancel.RSessionTime(0)            
0
p_parthaCommented:
just give
Print strFirstName
Print strLastName
Print strCourseName
Print strSessionDate
Print strSessionTime

Partha
0
imjameswAuthor Commented:
Nothing


Where should this go in the agent

I put under the above statments
0
imjameswAuthor Commented:
This is nor updating the log file either

weird
0
madheeswarCommented:
Keep like this:
strFirstName = docCancel.RFirstName(0)
strLastName = docCancel.RLastName(0)
strCourseName = docCancel.RCourseName(0)
strSessionDate = docCancel.SessionDate(0)
strSessionTime = docCancel.RSessionTime(0)    

Print strFirstName
Print strLastName
Print strCourseName
Print strSessionDate
Print strSessionTime

it won't update Log file. Insted, it will write the output to Browser.

Good work Partha. keep it up.
0
Sjef BosmanGroupware ConsultantCommented:
I hardly ever use Print or MsgBox to do debugging. I created a logging class with functions that log to 1) the agent's log, 2) a mail, 3) a database based on AgentLog template, 4) any combination of the three. The debugging level is selectable in a profile document.

I use the NotesLog class to do the logging. You might want to check that class in the Help db. The easiest place to log to for an agent is in it's own log. You can inspect the agent's log when you open the db's agents view, right-click on the agent, you'll see Log... at the bottom.

Basically, I stuff the code with sensible logging statements, and, of course, the On Error Goto as described above by Partha.

I hope you can find the error. Investing in a set of logging-functions like mine really pays off in the long run.
0
Bozzie4IT ArchitectCommented:
yes, but for development purposes, it's easy to quickly add a msgbox statement, just to see how far the code runs without problems (for instance).

Just remember to remove them after development, because they do cause some degraded performance (no logging = faster)
Then a Noteslog class is better : only create it and only log on errors!

cheers,

Tom
0
Sjef BosmanGroupware ConsultantCommented:
Partha: Jackpot!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.