title: Xpages - Repeat control with SSJS
body: <p>I am building a history tracker, that continues to work with legacy code in non xpage apps. For xpage apps, I simply call the below function. This works fine:</p>
  
  <pre><code>function AddObjectivesHistoryItem(doc, dt, action, username){
  
  var ArrDocHistory:array = doc.getItemValueArray("History");
  
  if(ArrDocHistory.length &lt; 1){
  
  // This should always return an object as it is created when an objectives 
  document is first 
  // created but do this check to be safe and create an array if for some 
  reason it doesnt exist
  ArrDocHistory = [dt+"|"+action+"|"+username];
  }else{
  // append new value to the array
  ArrDocHistory.push(dt+"|"+action+"|"+username);
  }
  return ArrDocHistory;
  }
  </code></pre>
  
  <p>The issue I have, is splitting and displaying the 3 data types. I have a 3 computed fields, which is date, username and status in a table within a repeat control, code, including first column and computed field below, this should be all values prior to the first pipe delimiter for each multi value.:</p>
  
  <pre><code>&lt;table class="table table-hover"&gt;
   &lt;thead&gt;
  &lt;tr&gt;
    &lt;th&gt;Date&lt;/th&gt;
    &lt;th&gt;Action&lt;/th&gt;
    &lt;th&gt;Username&lt;/th&gt;
  &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;/table&gt;
                  &lt;table class="table table-hover"&gt;
        &lt;xp:repeat value="#{document1.History}" var="row"&gt;
  &lt;tbody&gt;
  &lt;tr&gt;
    &lt;td&gt;
              &lt;xp:text escape="true" id="computedField1"&gt;
                  &lt;xp:this.value&gt;&lt;![CDATA[#{javascript:var ArrDocHistory:array = document1.getItemValueArray("History");
  print ("LEN: " + ArrDocHistory.length);
  var test:array = new Array();
  for (i=0; i&lt;ArrDocHistory.length; i++){
  var split = ArrDocHistory[i].split("|");
  test.push(split[0]);
  //return split[i]
  }
  return test}]]&gt;&lt;/xp:this.value&gt; 
              &lt;/xp:text&gt;&lt;/td&gt;
  </code></pre>
  
  <p>However, what this displays is all the values, in a line, seperated with a comma. For example, "value1, value2, value3" where as I expected, and need, and can't seem to be able to get each value to display on its own, in a new row. For example:</p>
  
  <p>value1</p>
  
  <p>value2</p>
  
  <p>value3</p>
  
  <p>I know I'm doing something silly, but am currently suffering from tunnel vision so any pointers greatly appreciated.</p>