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



Jan 27, 2012, 8:54 PM
27 Posts
topic has been resolvedResolved

Data Is Truncated after 64K (Sever Side Javascript)

  • Category: Server Side JavaScript
  • Platform: Windows
  • Release: 8.5.2
  • Role: Developer
  • Tags: memory,64k,truncated
  • Replies: 3
 Help anyone!

I have the following code used in an XPage Custom Control:

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:text escape="false">
<xp:this.value><![CDATA[#{javascript:
var html = '';
html += mainControl.getItemValueString(compositeData.get('fieldName'));
html += '<br/>';
html;}]]></xp:this.value>
</xp:text>
</xp:view>

I know that the data (a RichText field) is much larger than 64K, but the "getItemValueString" (and "getItemValue") is truncating the data after 64K.
How do you get the data past 64K or simply all the data?

Thanks you for any help or suggestions!

Alex
Jan 30, 2012, 12:53 PM
261 Posts
Re: Data Is Truncated after 64K (Sever Side Javascript)
Alex,
 
Try the getUnformattedText() method. Assuming that "mainControl" is a NotesXspDocument object:
 
<xp:this.value><![CDATA[#{javascript:
var item = mainControl.getDocument().getFirstItem(compositeData.get('fieldName'));
var html = item.getUnformattedText() + "<br />";
return html;
}]]></xp:this.value>

 
Mark
Jan 30, 2012, 5:33 PM
27 Posts
Re: Data Is Truncated after 64K (Sever Side Javascript)
Thank you for this very helpful reply!   ...this is pretty much what I'm looking for, except I can't quite get it working.  I have slightly modified it to be:
 
var item:NotesRichTextItem = mainControl.getDocument().getFirstItem(compositeData.get('fieldName'));
html = item.getUnformattedText() + '<br />'; 
 
...but this give me the following error: 
 
Error calling method 'getUnformattedText()' on an object of type 'lotus.domino.local.Item [Static Java Interface Wrapper, lotus.domino.local.Item: lotus.domino.Item]'
 
I was under the impression that adding ":NotesRichTextItem" to the end of the variable would cast it to the appropriate object type. 
 
Am I missing something?  Thanks again for any help!
Jan 30, 2012, 9:19 PM
27 Posts
Re: Data Is Truncated after 64K (Sever Side Javascript)
 I think I have this working now - for those that need to know how to get around size limits, the following code returns all the data:
 
var item = mainControl.getDocument().getFirstItem(compositeData.get('fieldName'));
html = item.getValueString() + '<br />';
 
...as the getValueString method deals with Rich Text with the following caveat:  This method returns a rich-text item rendered to plain text. Formatting and embedded objects are lost.
 
 

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