1
votes

I am new to Domino designer and lotus script,

I tried to access my text field by:

Sub Click(Source As Button)
    Dim  myText As String
    myText = Inputbox("insert some text :","Testing Heading","Default value test",100,100)
    Msgbox "you have entered : "+myText 
    [myfield].text = myText  //error
End Sub

but it shows an error:

named product field does not exist

Googled for it but can't find the solution.

One more, searched for tutorials for creating forms,views,database in domino designer for beginners. But can't find one.

If possible please provide links to tutorial sites.

EDIT 1:

Sub Click(Source As Button)
    Dim  myText As String
    Dim workspace As New NotesUIWorkspace
    Dim uidoc As NotesUIDocument
    Dim doc As NotesDocument
    Dim  enteredText As String
    myText = Inputbox("insert some text :","Testing Heading","Default value",100,100)
    Msgbox "you have entered : "+myText 
    Set uidoc = workspace.CurrentDocument
    Set doc = uidoc.Document
    doc.addrfield = myText

    enteredText = doc.addrfield 
    Msgbox "Data entered in addrfield : "+ enteredText //error
End Sub

Error:

Object variable not set

EDIT 2:

@Knut In Domino Designer, how database tables can be created ? I mean something like create table <tablenam> (field1,feild2,..);
How can I access it. I refered this. This guy showed me how how to connect to database but did't show how to create DB table.

1
For EDIT 1: use enteredText = doc.addrfield(0) - see my comment below my answer - Knut Herrmann
For EDIT 2: there is no create table in Notes. You just create a document and set the items (=fields) you like. Usually you create a form with fields and create the document based on that form. But you can also create a document with Notes classes. Notes is a non-relational document based database. Look here for more: nsftools.com/misc/WhatIsNotes.htm - Knut Herrmann

1 Answers

2
votes

You have to use the LotusScript Notes classes to

  • get the current open UI document
  • get the corresponding back-end document
  • set the item (=field)

Your example would look like this then:

Sub Click(Source As Button)
    Dim  myText As String
    Dim workspace As New NotesUIWorkspace
    Dim uidoc As NotesUIDocument
    Dim doc As NotesDocument
    myText = Inputbox("insert some text :","Testing Heading","Default value",100,100)
    Msgbox "you have entered : "+myText 
    Set uidoc = workspace.CurrentDocument
    Set doc = uidoc.Document
    doc.myField = myText
End Sub

You could use doc.ReplaceItemValue instead. It gives you a bit more flexibility.

The Designer help file itself gives you an introduction to Notes development in chapter "Application Design".