Solved

Clearing all fields on a Form in LotusScript

Posted on 2000-04-25
7
971 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
  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…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

911 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

22 Experts available now in Live!

Get 1:1 Help Now