Solved

Clearing all fields on a Form in LotusScript

Posted on 2000-04-25
7
976 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

  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…
For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
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…

813 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

10 Experts available now in Live!

Get 1:1 Help Now