Solved

Lotus Notes GetItemValue = Type Mismatch using VBScript

Posted on 2007-11-19
4
2,917 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

733 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