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 9, 2013, 4:02 PM
18 Posts

Testing for existence of a NotesDocument in JS

  • Category: Server Side JavaScript
  • Platform: Windows
  • Release: 9.0
  • Role: Developer
  • Tags:
  • Replies: 1

I am writing some Javascript in a computed field of a data view. 

I am getting a handle on the current document, then trying to get the response document, if it exists, and then print out some stuff.

Here is a code fragement

 

if (parDoc.getResponses().getCount() > 0) 
{
var rspDC:NotesDocumentCollection    = parDoc.getResponses()
var rspDoc:NotesDocument                 = rspDC.getFirstDocument;
 
if( rspDoc != null){
var s = rspDoc.getItemValueString("isfinal");
}
{
}
 

}

 

I get this error at the line starting with var s:

 

Script interpreter error, line=34, col=32: [TypeError] Error calling method 'getItemValueString(string)' on an object of type 'function [JavaScript Object]'

 

This is driving me crazy. I am testing for the existence of the doc, but even if I find it, it still gives an error. I have checked that that field exits, tried other fields, etc.

 

Any help would be greatly appreciated.

 

Bryan

Aug 9, 2013, 4:28 PM
18 Posts
[FIXED]

I am writing some Javascript in a computed field of a data view. 

I am getting a handle on the current document, then trying to get the response document, if it exists, and then print out some stuff.

Here is a code fragement

 

if (parDoc.getResponses().getCount() > 0) 
{
var rspDC:NotesDocumentCollection    = parDoc.getResponses()
var rspDoc:NotesDocument                 = rspDC.getFirstDocument;
 
if( rspDoc != null){
var s = rspDoc.getItemValueString("isfinal");
}
{
}
 

}

 

I get this error at the line starting with var s:

 

Script interpreter error, line=34, col=32: [TypeError] Error calling method 'getItemValueString(string)' on an object of type 'function [JavaScript Object]'

 

This is driving me crazy. I am testing for the existence of the doc, but even if I find it, it still gives an error. I have checked that that field exits, tried other fields, etc.

 

Any help would be greatly appreciated.

 

Bryan

 

================

 

Forget it, I found my error:  Needed a  () on the rspDC.getFirstDocument!!!!

 

 


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