一. Ls 中对域的取值问题:
对于 LotusScript,除了Rich-Text域外的元素,如文本、单选框、列表框、复选框等,你可以用几乎相同的代码取得它们的值。例如:如果有一个 Location”域,不论它是何种类型,你都可以用下面的LotusScript代码取得它的值:
fieldVals = doc.Location
或者这样:
fieldVals = doc.GetItemValue("Location")
二. 我如何在页面上建立一个热点,让它打开一个文档?
在页面上写一段文字,然后选上这段文字,然后点菜单”创建”热点--操作热点
然后选LotusScript ,举个例子,比如打开ID NT00000C62的文档:
Sub Click(Source As Button)
Dim uiworkspace As New notesuiworkspace
Dim curdatabase As notesuidatabase
Dim database As notesdatabase
Dim doc As notesdocument
Set curdatabase = uiworkspace.currentdatabase
Set database = curdatabase.database
Set doc = documentbyid("00000C62")
Call uiworkspace.EditDocument(True,doc,False )
End Sub
三. 我如何实现归档,比如我如何把当前视图中所有被选中的文档归入文件夹 fold ?
lotusScript象如下这样实现:
Sub AddDocToFold(fold As String)
Dim uiworkspace As New notesuiworkspace
Dim uiview As notesuiview
Dim doc As NotesDocument
Dim docList As String
Set uiview = uiworkspace.currentview
For j = 1 To uiview.Documents.Count
Set doc = uiview.Documents.GetNthDocument(j)
Call doc.PutInFolder( fold )
Next
End Sub
四. 我如何实现把某文件夹视图中的被选择的文档从该文件夹中清除,但却不能删除他们?
Script 实现如下:
Sub RemoveDocFromFold( fold As String,all As Integer)
'功能:
' trim函数的作用是删除文本的什么空格把文档从某个文件夹中移走,但并不删除此文档
'参数:
' fold: 文件夹
' all : 0表示仅移走当前选择的文档,1表示移走该文件夹中所有文档
Dim uiworkspace As New notesuiworkspace
Dim uiview As notesuiview
Dim doc As NotesDocument
Dim view As notesview
Set uiview = uiworkspace.currentview
Set view = uiview.view
If all = 0 Then '移去所选文档
For j = 1 To uiview.Documents.Count
Set doc = uiview.Documents.GetNthDocument(j)
Call doc.RemoveFromFolder( fold )
Next
Else
If all=1 Then '移去全部文档
Set doc = view.GetFirstDocument
'遍列该视图的所有文档,获取所有满足条件的纪录数
While Not(doc Is Nothing)
Call doc.RemoveFromFolder( fold )
Set doc = view.GetNextDocument(doc)
Wend
End If
End If
'Evaluate("@Command([ViewRefreshFields])")
End Sub
五. 我如何把当前视图中的所有的被选择的文档的某个域的值替换掉?
lS 实现如下:
Sub SelectedDocFieldReplace( Field As String,repval As String)
'功能:
' 把所选文档中的每个 Field 域的值 改为 repval
'参数:
' Field 要更改的域的名称
' repval 修改后的域值
Dim uiworkspace As New notesuiworkspace
Dim uiview As notesuiview
Dim doc As NotesDocument
Dim order_num As String
'order_num = Inputbox$("请输入批次")
Set uiview = uiworkspace.currentview
For j = 1 To uiview.Documents.Count
Set doc = uiview.Documents.GetNthDocument(j)
On Error Goto lable1
placeitemvalue(Field,repval)
Call doc.save(True,False)
Next
Exit Sub
lable1:
Msgbox("错误!,所选文档没有指定的域,这个错误发生在没有给 selectedDocFieldReplace() 函数传递正确的参数")
Exit Sub
End Sub
六. 如何实现表单上的内容根据用户的输入动态变化?
一般可以用notes的隐藏属性功能来控制,使用当公式为真是隐藏,然后靠公式来控制具体怎样隐藏.比如可以在对话筐上放一个对话筐列表, 里面放十个选项,当用户选择了其中的某几个选项时,响应的在下面的表单部分显示几行.这可以画一个表格,这个表格的属性中设置边框的线条粗细为零.然后对应十个选项分为十行,每行填入和选项响应的内容,然后选定某一行的所有文本,编辑其隐藏属性,选当公式为真时隐藏,这个公式您就可以写成当选项的被选中条目中不包含本行文字时隐藏就可以了,这样这一行就会在响应的选项被选中时才会显示.
七. 如何将查询结果放到一个文件夹里?
下面是将搜索结果放到名叫newfolder的文件夹中,并跳转到该文件夹上
Sub Click(Source As Button)
dim uiw as new notesuiworkspace
dim uidoc as notesuidocument
dim doc as notesdocument
set uidoc = uiw.currentdocument
set doc = uidoc.document
dim ss as new notessession
dim db as notesdatabase
set db = ss.currentdatabase
const newfolder = "文件夹名称"
Dim docs As notesdocumentcollection
q=doc.query(0)
Set docs = db.ftsearch(q, 0)
Call docs.PutAllInFolder( newfolder )
Call uiw.OpenDatabase( ,,newfolder)
End Sub
八. 如何在Notes中调用ODBC数据源中的进程?
Dim session As New NotesSession
Dim con As New ODBCConnection
Dim qry As New ODBCQuery
Dim result As New ODBCResultSet
Set qry.Connection = con
Set result.Query = qry
con.ConnectTo(资料库)
qry.SQL = SELECT * FROM 资料库
result.Execute
If result.IsResultSetAvailable Then
Do
result.NextRow
id=result.GetValue(ID,id)
Loop Until result.IsEndOfData
result.Close(DB_CLOSE)
Else
Messagebox "Cannot get result set for AssetData"
Exit Sub
End If
con.Disconnect
End Sub
九. 获得当前视图中选择了的文档?
可以用 Notesdatabase Unprocesseddocuments 属性。
Dim session As New notessession
Dim db As notesdatabase
Dim collection As notesdocumentcollection
Set db = session.currentdatabase
Set collection = db.UnprocessedDocuments
Unprocesseddocuments 其实很有用的
一十. notesExcel交换数据
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim excelApplication As Variant
Dim excelWorkbook As Variant
Dim excelSheet As Variant
Dim i As Integer
Set excelApplication = CreateObject(Excel.Application)
excelApplication.Visible = True
Set excelWorkbook = excelApplication.Workbooks.Add
Set excelSheet = excelWorkbook.Worksheets(Sheet1)
excelSheet.Cells(1,1).Value = 姓名
excelSheet.Cells(1,2).Value = 年龄

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。