• Error on JSONArray.ReplaceItemValue(JSONWrapperConverters)

    By Sanmao Zhao 1 decade ago

    The following code:

    Dim w As New JSONArray
    w.AddItem("a")
    w.AddItem("b")
    w.AddItem("c")
    Call w.ReplaceItemValue(1, "new")
    MsgBox w.ToJSON()
    

    The expected result is:
    [“a”,“new”,“c”]

    Actual results are:
    [“a”,“b”,“c”]

    Problem lies in the the following code:

    Public Sub ReplaceItemValue(p_iIndex As Integer, p_vValue As Variant)
        On Error Goto ErrorHandler
        If Isarray(Me.m_vData) Then
            If Ubound(Me.m_vData) <= p_iIndex Then
                If Isobject(p_vValue) Then
                    Set Me.m_vData(p_iIndex) = p_vValue
                Else
                    Me.m_vData(p_iIndex) = p_vValue
                End If                
            End If
        End If
    Done:
        Exit Sub
    ErrorHandler:
        Call Me.RaiseError(Error)
    End Sub
    

    Highlighted “«/span>=” should be “>=“.
    Thanks!

    • By Sanmao Zhao 1 decade ago

      “>=” in code should be “>=“:

      Ubound(Me.m_vData) <= p_iIndex

    • By Lars Berntrop 9 years ago

      Thanks! I already found this and replaced it by a Lotusscript List structure to accomodate large arrays (i.e. more than 32k of members).

      New version forthcoming.