CreepyD
asked on
Lotus Notes GetItemValue = Type Mismatch using VBScript
Basically I've looked everywhere for this, and my code appears to be correct.
I've tried using:
arrName = fDoc.Getitemvalue("PC_Name ")(0)
But that errors with a Type Mismatch
Using:
arrName = fDoc.Getitemvalue("PC_Name ")
Does work and puts the data in, but then I try to access it and get type mismatch.
I tried doing:
wscript.echo fUNID(0)
and that works.
But replace it with arrName(0) and I get a type mismatch.
In the variable window, they are both exactly the same, and both contain 1 string value (0)
The data IS there, as I can see in the variable window, that the correct data is showing up under arrName(0)
I've tried Dimming, but as I'm not using option explicit that doesn't matter I don't think.
Any ideas?
I've tried using:
arrName = fDoc.Getitemvalue("PC_Name
But that errors with a Type Mismatch
Using:
arrName = fDoc.Getitemvalue("PC_Name
Does work and puts the data in, but then I try to access it and get type mismatch.
I tried doing:
wscript.echo fUNID(0)
and that works.
But replace it with arrName(0) and I get a type mismatch.
In the variable window, they are both exactly the same, and both contain 1 string value (0)
The data IS there, as I can see in the variable window, that the correct data is showing up under arrName(0)
I've tried Dimming, but as I'm not using option explicit that doesn't matter I don't think.
Any ideas?
Set notessession = CreateObject("Notes.Notessession")
Set notesdb = notessession.GetDatabase("SERVER", "DATABASE.nsf")
Set notesView = notesdb.getview("VIEW NAME")
Set fDoc = notesView.getFirstDocument
i = 0
Set fDoc = notesView.GetFirstDocument
ReDim fUNID(0)
Do While Not fDoc Is Nothing
ReDim Preserve fUNID(i)
fUNID(i) = fDoc.UniversalID
arrName = fDoc.Getitemvalue("PC_Name")
wscript.echo arrName(0) 'ERROR IS HERE
Set fDoc = notesView.GetNextdocument(fDoc)
i=i+1
Loop
Or this, converting explicitly to a string-type:
arrName = fDoc.Getitemvalue("PC_Name")
wscript.echo CStr(arrName(0))
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, that link is perfect!
It was certainly weird being able to assign it and see the data, but not do anything with it.
It was certainly weird being able to assign it and see the data, but not do anything with it.
Open in new window