Solved

Clearing all fields on a Form in LotusScript

Posted on 2000-04-25
7
983 Views
Last Modified: 2013-12-18
Is there a command that will clear all the fields on a form?
0
Comment
Question by:roosterup
  • 4
  • 2
7 Comments
 

Expert Comment

by:Scott2000
ID: 2748014
Hi rooster,

Howabout something like:

Forall item In doc.Items
     item.Remove
     doc.Save True, True
End Forall

Regards,

Scott.
0
 
LVL 1

Author Comment

by:roosterup
ID: 2748984
I tried to use the following code, but this didn't work.  Can I clear all the field on my UI document? I'm not sure I understand the relationship between NotesDocument and NotesUiDocument


Dim WS As New notesUIWorkspace
Dim uidoc As NotesUiDocument
Set uidoc = ws.currentdocument

Dim doc As NotesDocument
Set doc = uidoc.Document

Forall item In doc.Items
     item.Remove
End Forall
0
 
LVL 5

Expert Comment

by:snocross
ID: 2749232
Try this in place of the set uidoc you are using:

Set UIDoc = session.DocumentContext
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

 

Accepted Solution

by:
Scott2000 earned 10 total points
ID: 2750310
Hi rooster,

Ok, the NotesDocument can be thought of as the physical representation of the notesuidocument you are viewing on screen.

If you need to clear all fields on the uidocument, it is not so easy.

For hidden fields, you will probably need to remove each value by specifying them by name.

For fields that are editable and assuming the uidocument is in edit mode, you could use uidoc.gotoPrevField and uidoc.gotoNextField to loop through all of the fields.

Can I ask why you need to clear all fields in the uidocument.  It may help us understand the problem better.

Regards,

Scott.
0
 
LVL 1

Author Comment

by:roosterup
ID: 2751697
I am accessing an AS/400 using an ODBC connection to do a lookup on DB/2 files. I'm creating a form for displaying parts, one record at a time, when I want to look at the next part, I need to clear the fields for the current part.

The example I have uses:
"Call uidoc.Fieldsettext" to populate the fields on my form. Is there a better way to do this? Should I be creating a NotesDocument and setting it to Uidoc, then populate the NotesDocument fields?

thanks for your comments so far, i will try it.
0
 

Expert Comment

by:Scott2000
ID: 2751821
If you are creating documents based on result queries and you don't need to see them created on screen, you would be better using the NotesDocument than the NotesUIDocument

If this is the case, here's how to create a notesdocument instead (not included the ODBC conns since you obviously have that already:

Dim doc as NotesDocument
Dim db as NotesDatabase
Dim session as New NotesSession

Set db = session.CurrentDatabase
Set doc = db.CreateDocument

'Here you would have your loop I guess e.g. (While not (rs.eof))
   doc.Form = "FormName"
   doc.FieldName = "Some value from recordset"
   doc.FieldName2  = Some other value"
   doc.Save True, True
'End of the loop (Wend)

If you must use the uidocument to display as you get them, then the previous comments in the last message still apply....

Cheers,

Scott.

p.s. not back in work until Tuesday, so hope this is enough to help
0
 

Expert Comment

by:Scott2000
ID: 2751826
Sorry that should read:


Dim doc as NotesDocument
Dim db as NotesDatabase
Dim session as New NotesSession

Set db = session.CurrentDatabase  

'Here you would have your loop I guess e.g. (While not (rs.eof))
    Set doc = db.CreateDocument
    doc.Form = "FormName"
    doc.FieldName = "Some value from recordset"
    doc.FieldName2  = Some other value"
    doc.Save True, True
'End of the loop (Wend)
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

792 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