我使用以下网站作为将Lotus Notes数据库表单导出到csv文件的指南。
http://searchdomino.techtarget.com/tip/How-to-export-data-from-a-Lotus-Notes-database-to-a-CSV-file
SELECT MEMBERS.lname, MEMBERS.fname, MEMBERS.email, PRODUCTS.scancode
, PRODUCTS.description, ARTRANS.datetrans, ARTRANS.memid
, ARTRANS.invoice, ARTRANSITEMS.price, ARTRANSITEMS.quantity
FROM PRODUCTS
INNER JOIN ARTRANSITEMS ON PRODUCTS.productid = ARTRANSITEMS.productid
INNER JOIN ARTRANS ON ARTRANSITEMS.transid = ARTRANS.transid
INNER JOIN PRODUCTCATS ON PRODUCTS.productcatid = PRODUCTCATS.productcatid
INNER JOIN MEMBERS ON ARTRANS.memid = MEMBERS.memid
WHERE PRODUCTS.productcatid IN ('20' ,'21','78')
AND (ARTRANS.datetrans BETWEEN @rvMonthOneStart AND @rvMonthOneEnd)
AND NOT EXISTS (SELECT 1
FROM PRODUCTS AS P2
INNER JOIN ARTRANSITEMS AS ATI ON P2.productid = ATI.productid
INNER JOIN ARTRANS AS ART2 ON ATI.transid = ART2.transid
INNER JOIN PRODUCTCATS AS PC2 ON P2.productcatid = PC2.productcatid
INNER JOIN MEMBERS AS M2 ON ART2.memid = M2.memid
WHERE PRODUCTS.productcatid IN ('20' ,'21','78')
AND (ART2.datetrans BETWEEN DATEADD(month, 1, @rvMonthOneStart) AND DATEADD(month, 1, @rvMonthOneEnd))
AND M2.memid = MEMBERS.memid)
哪个更容易,我想指定要导出或导出整个表单的字段,除了一组特定的字段。
答案 0 :(得分:1)
Knut Herrmann在他的回答中建议的另一种方法是创建一个要导出的字段列表,然后在ForAll循环中测试eaxch字段是否是该列表的成员:
Dim exportField List As String
exportField("FieldOne") = "FieldOne"
exportField("FieldTwo") = "FieldTwo"
exportField("FieldFive") = "FieldFive"
循环:
ForAll formfield In form.Fields
If IsElement(exportField(formfield)) Then
newvalue=doc.GetItemValue(formfield)
values=values & |"| & CStr(newvalue(0)) & |",|
End If
End ForAll
我使用字符串列表是有原因的。您可以放置特殊格式命令或指示数据类型,而不是将字段名称放在那里。然后在循环中使用它来相应地格式化CSV输出:
Dim exportField List As String
exportField("FieldOne") = "T" '*** Text
exportField("FieldTwo") = "DT" '*** Date and Time
exportField("FieldFive") = "N" '*** Numeric
exportField("FieldSix") = "D" '*** Date only
然后,您只需检查值并正确格式化输出。
答案 1 :(得分:0)
form.Fields
会返回所有字段的名称。测试此字段名称以排除其中的一些:
...
ForAll formfield In form.Fields
If formfield <> "AdditionalDocumentation" And formfield <> "AnotherFieldName" Then
newvalue=doc.GetItemValue(formfield)
values=values & |"| & CStr(newvalue(0)) & |",|
End If
End ForAll