Hai All, I want to use the command:- @setfield(“Error”;“User Id Password wrong”)
in Lotus Script.
if uid=vuid And pass=vpass Then
Print||
else
macro$=“@setfield(error;Wrong)”
result = Evaluate(macro$, doc)
end if
I am running the agent in web
But Its Not working
Please Guide me
Subject: How to User @setfield in Lotus Script
hi pawan…
Evaluates works on funcions which return a value and not in functions which sets a value…
you can add these lines of code insted of evalute…
Dim session on new NotesSession
Dim NotesDocument doc
set doc = session.DocumentContext
doc.fieldName = “Field Value”
kaushik das
wdc
Subject: RE: How to User @setfield in Lotus Script
Hai Chris Harris & Kaushik, Thanks for the Goog Suggession.
Both the codes are working.
macro={@Setfield(“Error”;“Please Enter The Correct User Id or Password”)}
msg=Evaluate(macro,udoc)
udoc.error = “User Id Password Wrong”
Thanks for ur Support
Pawan
Subject: RE: How to User @setfield in Lotus Script
“Not working” is not a sufficiently precise description of the error.
There is no point in using @SetField and Evaluate in LotusScript. That is very inefficient. If you have a NotesDocument object in your script, the preferred way to assign the field is:
Call doc.ReplaceItemValue(“fieldname”, value)
This will also work in most cases:
doc.fieldname = value
However, if the field has the same name as a built-in property or method of NotesDocument, LotusScript will not realize that you mean the field. Error is not a property of NotesDocument now, but it might not be safe to assume that there will never be such a property.
So, as of today, doc.Error = “some string” should work just fine. If it’s not working, there is something else wrong in your script.
To find out what the actual problem is, here are some things you can try:
Use option declare. This will force you to declare all your variables, so if you have a variable that is not being spelled the same in all parts of your code you should notice it. (doc or udoc).
Read this article for some tips about trapping and displaying errors.
If this doesn’t solve the problem, you need to show more source code, and describe exactly how it fails. I’m not going to respond to this thread again unless sufficient information is given.
Subject: How to User @setfield in Lotus Script
if you’re using lotuscript then why not just use:
doc.error = “User Id Password Wrong”
I assume this is a web query save agent?