【问题标题】:Lotus Notes: Print/write variant() to freefile() .csvLotus Notes:打印/写入 variant() 到 freefile() .csv
【发布时间】:2015-01-30 18:51:43
【问题描述】:

我只是想问一下如何将 variant() --> "tmpArray" 打印到 .csv?因为在我现在拥有的代码中,它只访问数组中的第一个值。我想访问数组中的所有值并将其打印在 .csv 文件中。下面是我的代码。将不胜感激任何建议/帮助。谢谢。

例如,我有 3 个相同值的文档。

tmpArray3(0) = 2,999
tmpArray3(1) = 4,999
tmpArray4(0) = 1,000
tmpArray4(1) = 5,903

为第一个文档打印的是:2,999 和 1,000。 正在为第二个文档打印的是:2,999 和 1,000。 正在为第 3 个文档打印的是:2,999 和 1,000。

它没有处理变量数组中的第二个值。

 Do While doccount1 < 11 AND Not v2entry Is Nothing

            ReDim Preserve tmpArray3(tmpcount3)
            ReDim Preserve tmpArray4(tmpcount4)

            tmpArray3(tmpcount3) = v2entry.ColumnValues(3)
            tmpArray4(tmpcount4) = v2entry.ColumnValues(4)
           

            doccount1 = doccount1 + 1

            tmpcount3=tmpcount3 + 1
            tmpcount4=tmpcount4 + 1
         

            Print #datafileNum%,(tmpArray3(0) & ";" & tmpArray4(0))
            Set v2entry = vc.GetNextEntry(v2entry)

        Loop
    Next
    Close datafileNum%
    Exit Sub

【问题讨论】:

    标签: lotus-notes notesview


    【解决方案1】:

    一个问题是,在您的 Print 语句中,您正在访问 tmpArray3 和 tmpArray4 数组的第一个索引(即索引 0)。您需要在其中放置一个变量。

    例如:

     Do While doccount1 < 11 AND Not v2entry Is Nothing
    
                ReDim Preserve tmpArray3(tmpcount3)
                ReDim Preserve tmpArray4(tmpcount4)
    
                tmpArray3(tmpcount3) = v2entry.ColumnValues(3)
                tmpArray4(tmpcount4) = v2entry.ColumnValues(4)
               
    
                doccount1 = doccount1 + 1
                           
    
                Print #datafileNum%,(tmpArray3(tmpcount3) & ";" & tmpArray4(tmpcount4))
                Set v2entry = vc.GetNextEntry(v2entry)
    
                tmpcount3=tmpcount3 + 1
                tmpcount4=tmpcount4 + 1
    
            Loop
        Next
        Close datafileNum%
        Exit Sub

    但是,您也总是从 v2entry.ColumnValues() 中检索索引 3 和 4。我假设您也想用变量替换 3 和 4

    【讨论】:

    • 完美运行!非常感谢。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多