This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



May 20, 2011, 10:07 AM
35 Posts

Re: Get fields from names.nsf on Xpage

  • Category: Server Side JavaScript
  • Platform: Linux
  • Release: 8.5.2
  • Role: End user,Developer,Administrator
  • Tags:
  • Replies: 8
Thx for your reply.
 
I added the line that you gave me to the javascript code of a computed field on my xpage in the Properties Tab - Value / Bind data using javascript section:
 
var db:NotesDatabase = session.getDatabase('', 'names.nsf');
var vw:NotesView = db.getView('$VIMPeople');
var userDoc:NotesDocument = vw.getDocumentByKey('Administrator/ChrisOrg', true);
var userFunc:String = userDoc.getItemValueString('Title');
 
 It still returns me 'userFunc' insteat of the Title field from names.nsf!
 
Any idea? 
 
Thx in advance, 
 
Chris 
May 20, 2011, 11:08 AM
33 Posts
Re: Get fields from names.nsf on Xpage
Hi, try to add one more line:
return userFunc; 

May 20, 2011, 12:07 PM
35 Posts
Re: Get fields from names.nsf on Xpage
Thx again for your help.
 
It returns me nothing... I have totally no idea why!
 
var db:NotesDatabase = session.getDatabase('', 'names.nsf');
var vw:NotesView = db.getView('$VIMPeople');
var userDoc:NotesDocument = vw.getDocumentByKey('Administrator/ChrisOrg', true);
var userFunc:String = userDoc.getItemValueString('Title');
return userFunc;
 
I tried changing 'names.nsf' to something else, this generates an error in db.getView => This indicates me that the NotesDatabase is OK
Then I changed the '$VIMPeople', this generates an error on getDocumentByKey=> This indicates me that the getView is OK
Then I changed the 'Administrator/ChrisOrg', this generates an error on getItemValueString => This indicates me that the getDocumentByKey is OK
Changing 'Title' did nothing, no errors!
 
But now I'm sure that the begin of my code is OK...
 
Thx 
May 20, 2011, 12:47 PM
33 Posts
Re: Get fields from names.nsf on Xpage
The method getItemValueString return an empty string if the item does not exist on the document. 
May 20, 2011, 1:09 PM
35 Posts
Re: Get fields from names.nsf on Xpage
You'are right, my fault !!!
 
It's JobTitle that I filed in, Title is empty => reason why it returned me an empty string. 
 
Thank you very much for your time and assistance. 

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal