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



Mar 22, 2013, 10:10 AM
17 Posts
topic has been resolvedResolved

Data table getColumnvalues

  • Category: Server Side JavaScript
  • Platform: Windows
  • Release: 8.5.3
  • Role: Developer,Administrator
  • Tags:
  • Replies: 2
I have a view that shows the attachments of a document.  The view is set to display multiple values as separate entries.  The view shows the Unid and the attachments so looks like this:
 

UNID                                              Attachments
AAAAAAAAAA123456789       document1.doc

AAAAAAAAAA123456789       document2.doc

AAAAAAAAAA123456789       anotherdoc.doc

BBBBBBBBBB987654321       figures.xls

BBBBBBBBBB987654321       march.xls

etc.....

When I try to display the values in the Attachments column I get document1.doc, document1.doc, document1.doc  ie, the first attachment times the number of attachments.   Where am I going wrong?  My code is below:

<?xml version="1.0" encoding="UTF-8"?>

<xp:view xmlns:xp="http://www.ibm.com/xsp/core"><xp:dataTable id="dataTable1" rows="30" style="width:259.0px" var="datadocs">

<xp:this.value><![CDATA[#{javascript:var tview:NotesView = database.getView("AttachmentView");

var v = "AAAAAAAAAA123456789";

var vc:NotesViewEntryCollection = null;

if (v != null) {

vc = tview.getAllEntriesByKey(v);

}

vc}]]></xp:this.value>

<xp:column id="column1"></xp:column>

<xp:column id="column2">

<xp:text escape="true" id="computedField1"><xp:this.value><![CDATA[#{javascript:var st = datadocs.getColumnValues()[1];

return @Text(st)}]]></xp:this.value></xp:text></xp:column>

</xp:dataTable>

</xp:view>

 
If I bind the data table to the entire view, the results are correct, but when I try to filter what is displayed is does not display what I would expect.

Many thanks.  
Mar 22, 2013, 1:36 PM
17 Posts
Re: Data table getColumnvalues
I have devised a workaround to this.

If I use getAllEntriesByKey() I can use getCount() to know how many entries there are. Call this 'docsinview'.

I then use GetAllEntries() and iterate through the entries until I find the first entry that matches. Call this 'start'.  I use this value as the Starting Index for the datatable and then use docsinview as the Repeat Limit of the datatable.

Not ideal, but it now works as I want it to:

Code for Starting Index:

var v = database.getView("Attachments");

var allvc:NotesViewEntryCollection = v.getAllEntries();

var start:Integer = 0;

var entry:NotesViewEntry = allvc.getFirstEntry();

while (entry != null){

if (entry.getUniversalID()== "BC846CCFDA41303180257B35003FE0C5"){

break;

}

else{

entry = allvc.getNextEntry();

start = start + 1;

}

}

return start


 
Code for Repeat Limit:  

 

var v = database.getView("Attachments");

var vc:NotesViewEntryCollection = v.getAllEntriesByKey("BC846CCFDA41303180257B35003FE0C5");

var docsinview = vc.getCount();

return docsinview

 
Mar 24, 2013, 8:26 PM
586 Posts
Re: Data table getColumnvalues
 I've just never had a lot of luck doing the show mull-values as multiple entries thing.  It always seems to be a good soltuion at the time but it usually mites me later on down the road.


 

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