Solved

Lotus Notes GetItemValue = Type Mismatch using VBScript

Posted on 2007-11-19
4
2,887 Views
Last Modified: 2013-12-18
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?

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

Open in new window

0
Comment
Question by:CreepyD
  • 2
4 Comments
 
LVL 31

Expert Comment

by:qwaletee
ID: 20313195
Try this
Do While Not fDoc Is Nothing

	ReDim Preserve fUNID(i)

	fUNID(i) = fDoc.UniversalID

						

	Set arrItem = fDoc.GetFirstItem("LastName")

	arrName = arrItem.Text

         wscript.echo arrName

 

	Set fDoc = notesView.GetNextdocument(fDoc)

	i=i+1

Loop

Open in new window

0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 20313322
Or this, converting explicitly to a string-type:
        arrName = fDoc.Getitemvalue("PC_Name")

        wscript.echo CStr(arrName(0))

Open in new window

0
 
LVL 31

Accepted Solution

by:
qwaletee earned 125 total points
ID: 20314637
Sjef, that also gives a type mismatch.  For some reason, VBS has a devil of a time dealing with Notes value arrays. WHether you get them via implicit attributes of the document, getItemValue, or getItem(...).Values, you can assign it, but you can't do anything with it.

See here http://www-10.lotus.com/ldd/nd6forum.nsf/0/72d14e06c0a90e76852572820054459b
0
 

Author Closing Comment

by:CreepyD
ID: 31409944
Thanks, that link is perfect!
It was certainly weird being able to assign it and see the data, but not do anything with it.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
jquery-like closest property in Microsoft Word? 6 38
Check version 13 71
Show hidden user account 7 56
Only allow one site in Internet Explorer on XenApp. 9 51
When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now