I have a Multivalue field which stores a value in 0th index. I'm trying to split the values using comma separator but it's throwing an error as type mismatch while I split the values. All the variables is declared as Variant datatype but still it throws the "Type Mismatch" error. Thanks in advance.
If Trim(doc.GetItemValue("fldPartNo_2")(0)) <> "" Then
arrPartNo = ArrayAppend(doc.GetItemValue("fldPartNo_1"), doc.GetItemValue("fldPartNo_2"))
Else
arrPartNo = doc.GetItemValue("fldPartNo_1")
End If
arrRecdQty = doc.GetItemValue("fldRecdQty")
arrUM = doc.GetItemValue("fldUM")
arr=Split(arrUM,",")
Dim n As Integer
n=0
Do Until arr=""
n=n+1
Loop
sno = sno+1
worksheet.cells(i,j).value= doc.Universalid
j=j+1
worksheet.cells(i,j).value=sno
j=j+1
'MsgBox(CStr(arrUM(0)))
For l=0 To n
worksheet.cells(i,j).value= arrPartNo(l)
j=j+1
worksheet.cells(i,j).value= arrUM(l)
j=j+1
worksheet.cells(i,j).value= arrRecdQty(l)
j=j+1
worksheet.cells(i,j).value= doc.Getitemvalue("fldReject_"+CStr(l+1))
j=j+1
If IsNumeric(Trim(arrRecdQty(l))) Then
If IsNumeric(Trim(doc.GetItemValue("fldReject_" + CStr(l + 1))(0))) Then
worksheet.cells(i,j).value= arrRecdQty(l) - doc.GetItemValue("fldReject_" + CStr(l + 1))(0)
j=j+1
Else
worksheet.cells(i,j).value= arrRecdQty(l)
j=j+1
End If
Else
worksheet.cells(i,j).value= ""
j=j+1
End If
Next
worksheet.cells(i,j).value= doc.GetItemValue("fldRemarks_" + CStr(l + 1))(0)
j=j+1
worksheet.cells(i,j).value= "N_MRN"
j=j+1
worksheet.cells(i,j).value= ""
j=j+1
worksheet.cells(i,j).value= ""
j=j+1
worksheet.cells(i,j).value= "True"
j=j+1
Set doc = vw.Getnextdocument(doc)
j = j + 1
sno=0
i = i + 1
j = 1
Wend
Get element 0 from arrUM first and then split the value by ","