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 27, 2011, 9:37 AM
29 Posts
topic has been resolvedResolved

Document collection for repeat control

  • Category: Debugging
  • Platform: All
  • Release: 8.5.2
  • Role: Developer
  • Tags:
  • Replies: 5
Hi,
 
For my iteration code i've got..

var userlookup:string=session.getCommonUserName();
clientview=database.getView("tasksUser");
dc=clientview.getAllDocumentsByKey(userlookup);
return dc
 
work like a charm.

if I change getAllDocumentsByKey to getAllEntriesByKey so the view is in order but I get an error, any hints?
Mar 27, 2011, 6:07 PM
4 Posts
Re: Document collection for repeat control
 
getAllEntriesByKey returns a ViewEntryCollection. 

Try declaring your "dc" variable as a ViewEntryCollection.
Mar 27, 2011, 11:19 PM
29 Posts
Re: Document collection for repeat control
I changed it to..
 
var userlookup:string=session.getCommonUserName();
clientview=database.getView("tasksUser");
var dc:NotesViewEntryCollection=clientview.getAllEntriesByKey(userlookup);
return dc
 
 but get error command not handled exception
Mar 28, 2011, 12:20 AM
4 Posts
Re: Document collection for repeat control
 
Do this...

1. In your application properties screen, click the "Xpages" tab. 
2. On that tab, click the "Display Xpage runtime error page" checkbox.
3. Close the application properties page and save your changes when prompted.

Now run your code.  This should give you more information about your error.
Mar 30, 2011, 2:44 AM
29 Posts
Re: Document collection for repeat control
Chuck, thanks heaps for that tip, pointed me in the right direction. It happens my code to get the DC was fine, it was my code to look up field values that caused the problem.
 
I put the following into my computed field value and all was sweet..

var doc:NotesDocument = rowdata.getDocument();
return doc.getItemValueString("projectNumber")
Mar 28, 2011, 8:24 AM
261 Posts
Re: Document collection for repeat control
Did you already define a variable name in the repeat to use for the data source? And if yes: did you already use that variable within the repeat? Changing the datasource from a document collection to a view entry collection requires that you also change how the data is handled.

Example: let's assume the variable is called "dataItem".

  • If the datasource of a repeat is a document collection, every entry ('dataItem") is a document and you can refer to fields using dataItem.getItemValueString("fieldName")
  • If the datasource is a ViewEntryCollection, you can refer to (1) column values using dataItem.getColumnValue("columnName") or (2) document field values using dataItem.getDocument().getItemValueString("fieldName")
Mark

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