【问题标题】:how to access textfield value in lotus script for Domino designer如何在 Domino 设计器的 Lotus 脚本中访问文本字段值
【发布时间】:2015-03-18 23:51:17
【问题描述】:

我是 Domino 设计器和 Lotus 脚本的新手,

我尝试通过以下方式访问我的文本字段:

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

但它显示错误:

指定的产品字段不存在

谷歌搜索,但找不到解决方案。

另外,搜索了初学者在 domino Designer 中创建表单、视图、数据库的教程。但是找不到。

如果可能,请提供教程网站的链接。

编辑 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

错误:

对象变量未设置

编辑 2:

@克努特 在 Domino Designer 中,如何创建数据库表? 我的意思是像创建表<tablenam> (field1,feild2,..);
我怎样才能访问它。我推荐了this。这家伙教我如何连接数据库,但没有教我如何创建数据库表。

【问题讨论】:

  • 对于编辑 1:使用 enteredText = doc.addrfield(0) - 请参阅我的回答下方的评论
  • 对于编辑 2:Notes 中没有创建表。您只需创建一个文档并设置您喜欢的项目(=字段)。通常您创建一个带有字段的表单并基于该表单创建文档。但是您也可以使用 Notes 类创建文档。 Notes 是一个基于非关系文档的数据库。在这里查看更多信息:nsftools.com/misc/WhatIsNotes.htm

标签: lotus-notes lotus-domino lotusscript lotus domino-designer-eclipse


【解决方案1】:

您必须使用 LotusScript Notes 类来

  • 获取当前打开的 UI 文档
  • 获取对应的后端文档
  • 设置项目(=字段)

您的示例将如下所示:

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

您可以改用doc.ReplaceItemValue。它为您提供了更多的灵活性。

Designer help file 本身在“应用程序设计”一章中为您介绍了 Notes 开发。

【讨论】:

  • Msgbox "Data entered in addrfield : "+ doc.[addrfield]text 如何从文本字段中检索
  • 它是Msgbox "Data entered in addrfield : "+ doc.addrfield(0)doc.addrfield 返回一个文本列表,使用 doc.addrfield(0) 你会得到第一个元素,在这种情况下是唯一的元素。
  • @Kunt 我已经更新了关于 DB 的问题,期待您的回复。
猜你喜欢
  • 2012-05-12
  • 2020-10-09
  • 1970-01-01
  • 1970-01-01
  • 2010-12-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多