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



Aug 6, 2012, 11:32 AM
8 Posts
topic has been resolvedResolved

To get the field of a Document.

  • Category: Server Side JavaScript
  • Platform: Not Applicable
  • Release: 8.5.3
  • Role:
  • Tags: xpages
  • Replies: 4

Hi all

 

The database contains a profile document. I should get the value of a field resides in that profile document. For example, Profile Document name is FDBProfile. And the field “Admin” has the UniversalID of that document.

And it also contains another field “Host”

 

 I used the following java-script code for getting the value of the field “Admin”.

 

var proDoc:NotesDocument = database.getProfileDocument("FDBProfile","");

 

proDoc.getItemValue("Admin")

 

Now the value of the above code will be in the field “Profile1”.To get the value of the field “Host” I used the following code.

 

var unid = getComponent("Profile1").getValue();

 var doc:NotesDocument = database.getDocumentByUNID(unid);

 doc.getItemValue("Host");

 

But it is showing error.

pls help me

 

 

 

Aug 6, 2012, 7:00 PM
586 Posts
Re: To get the field of a Document.
 Please post the error when you have one.  It would really help things.....
 
I can only guess that you should be doing:  getItemValueString("Host")  
 
etc... 
Aug 7, 2012, 5:34 AM
8 Posts
Re: To get the field of a Document.
Actually the error is in 2nd line.
 
Error while executing JavaScript computed expression
Script interpreter error, line=2, col=35: [TypeError] Method NotesDatabase.getDocumentByUNID(java.util.Vector) not found, or illegal parameters
Aug 7, 2012, 1:54 PM
366 Posts
Re: To get the field of a Document.
In the following code

var proDoc:NotesDocument = database.getProfileDocument("FDBProfile","");

 

proDoc.getItemValue("Admin")
 
the value being stored is a vector not the value in the field which is why your code is throwing the error. 
 
use getItemValueString("Admin") instead. 
 
This highlights one of the differences between the Java back end implementation versus lotusscript. 
 
 
 
Aug 8, 2012, 4:23 AM
8 Posts
Re: To get the field of a Document.
 yes now there is no error.
 
Thank you very much.

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