[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 304
  • Last Modified:

Adding new fields and labels dynamicly to Form in LotusScript???


I have to create a questionaire application using Lotus Notes.
I don't know much about LotusScript and I'm looking for some help!!

I want to put values from a View into new dynamic added fields.
Now the values appeare in a message box.

The code:

Sub Initialize
     Dim session As New NotesSession
     Dim db As NotesDatabase
     Dim doc As NotesDocument
     Dim docweg As NotesDocument
     Dim doc2 As NotesDocument
     Dim dc As NotesDocumentCollection
     Dim viewVraag As NotesView
     Dim viewAfgekeurd As NotesView
     Dim telafgekeurd As Integer
     Dim telgoedgekeurd As Integer
     Dim stringcijfer As String
     Dim cijfer As Integer
     Dim nummer As Integer
     Dim vraag As String
     Set db = session.CurrentDatabase
     Set viewVraag = db.GetView("vraagcommentaaroverzicht")
     Set viewAfgekeurd = db.GetView("vraagcommentaaroverzicht")
     Set doc = viewVraag.GetFirstDocument
     nummer = -1
     While Not(doc Is Nothing)
          nummer = nummer +1
          telafgekeurd = 0
          telgoedgekeurd  = 0
          vraag = doc.txt_vraagcommentaar(0)
          stringcijfer = doc.rb_cijfers(0)
          cijfer = stringcijfer
          Msgbox vraag
          Msgbox cijfer
          Set dc = viewAfgekeurd.GetAllDocumentsByKey(cijfer)
          Set doc2 = dc.GetFirstDocument
          While Not(doc2 Is Nothing)
               Msgbox cijfer
               If doc2.vraagcommentaaroverzicht(rb_cijfers) = "2" Then
                    telgoedgekeurd = telgoedgekeurd + 1
                    Msgbox telgoedgekeurd
               Elseif doc2.vraagcommentaaroverzicht(rb_cijfers) = "3" Then
                    telafgekeurd = telafgekeurd + 1
                    Msgbox telafgekeurd
               End If
               Set doc2 = dc.GetNextDocument(doc2)
          Set docweg = doc
          Set doc = viewVraag.GetNextDocument(doc)
          If telafgekeurd > telgoedgekeurd Then
               Msgbox "Deze vraag mag worden weggegooid"
               Call docweg.Remove(True)
          End If
          nummer = -1          
End Sub

I hope someone can help me...

Greetings Hanszie
2 Solutions
ZvonkoSystems architectCommented:
Look for this two methods of NotesDocument:

doc.AppendItemValue( FieldName$, FieldValue )

Call doc.RemoveItem( FieldName$ )

Good luck,

hanszieAuthor Commented:
thanks zvonko,

but "doc.AppendItemValue( FieldName$, FieldValue )" did not work.

I want to put fields on a Form not in a View.
ZvonkoSystems architectCommented:
There is NO way to change Form design with LotusScript.

This NotesDocument.AppendItemValue() creates new Field Values. The field values are contained in the stored Document. But the Fields are visible on the Form first after they are added trough Designer.

There is no way to create Fields on a Form without Designer (in R5).

Sorry to bring bad news.

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Bad news with points ?  Enjoy!

And hanszie - Zvonko is right.
hanszieAuthor Commented:
ok thats bat...

does somebody has an other idea for my problem.

Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now