This forum is closed to new posts and responses. New discussions are now taking place in the IBM Developer Answers forum.

Sep 27, 2018, 3:58 PM
1 Posts
topic has been resolvedResolved

Display Field Entries in Single Document as Rows

  • Category: Other
  • Platform: Not Applicable
  • Release: 9.0.1
  • Role: Developer
  • Tags: XPage development,repeat control
  • Replies: 1

While I've been working with xPages for several years, this is my first foray into using the repeat control, and I think I'm not correctly understanding how it works.

Here's what I'm trying to do:
I have a custom control with a tabbed table on it.  
I want to place a repeat control on one of the tabs which will display information from certain fields on a specific document that is looked up in another application.  My XPages application is solely for design and exchanges data with several applications.
I want only those fields which meet certain criteria to have other fields which have the same number-index displayed in a row.

Here's some JavaScript which describes when a row should be created:
var shopperDb = session.getDatabase(session.getServerName(), "newPeople.nsf");

/* The number of shoppers the person has referred who have completed 3 shops */
var allView = shopperDb.getView("All People");
var shopperAllDoc = allView.getDocumentByKey(sessionScope.shortID);

var num;
var total;
for ( num = 1; num < 41; num++){
  if (shopperAllDoc.hasItem("Child_"+ num)){
       total = 0;
        total = shopperAllDoc.getItemValueInteger("CompletedChild_" + num) - shopperAllDoc.getItemValueInteger"DnpChild_"+ num);
         if (total > 2 && shopperAllDoc.getItemValueString("RedStatus" + num).equals("1")){
               /* Put the values of other fields with the same num value such as FirstName_num, LastName_num in a row */

               return shopperAllDoc.getItemValueString("FirstName_" + num)  /* and return a bunch of other fields from the document
          /* Don't have anything display on the repeat control for the other fields with the same num value */

I've currently got this in the Value area of the repeat control.  But nothing is displayed at all - no errors - no data.

I should point out that this data would be display only and doesn't need to be retained.  Someone said in one of the postings that you need to have one repeat for the rows and then a second repeat for the columns - is this right?

How would I achieve this?

Any clarification would be much appreciated.

Oct 1, 2018, 1:21 PM
1 Posts
*By the way, you may want to move your questions to StackOverflow, better responses there!

This forum is closed to new posts and responses. New discussions are now taking place in the IBM Developer Answers forum.