Solved

Clearing all fields on a Form in LotusScript

Posted on 2000-04-25
7
1,001 Views
Last Modified: 2013-12-18
Is there a command that will clear all the fields on a form?
0
Comment
Question by:roosterup
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

688 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