title: Xpages - Display filtered Document Collection in a repeat control
body: <p>I have the following code which I have in the Bind data part of a repeat control. I have called the Collection Name 'docs'. I cannot seem to make any values appear in the view control. Computed Field - docs.getItemValue("Status"). Any ideas where I'm going wrong?</p>
  
  <pre><code>var v:NotesView = database.getView("xpageReports");
  viewScope.status=""
  
  // Created After
  var after = viewScope.crafter
  if(after==null)after = @Date(2000, 1, 1, 0, 0, 0);  
  
  // Created Before
  var before = viewScope.crbefore 
  if(before==null) before = @Date( @Tomorrow() );
  
  // Build Date Range
  var dr = session.createDateRange(after, before);
  
  // Status
  var status = viewScope.crstatus;
  if(status =="-select-") status =""
  // Department
  var department = viewScope.crdepartment;
  if(department =="-select-") department=""
  
  // Unit
  var unit = viewScope.crunit;
  if(unit ="-select-") unit=""
  
  var dc:NotesDocumentCollection = v.getAllDocumentsByKey(dr);
  if (dc.getCount() == 0) {
      viewScope.status = "0";
      return;
  }
  
  var count = 0
  var doc:NotesDocument = dc.getFirstDocument();
  while (doc != null) {
      var tmpdoc = dc.getNextDocument();
      var remove = 0
  
      @If(status!="",@If(doc.getItemValueString("Status")!=status,remove = remove + 1,""),"")
      @If(department!="",@If(doc.getItemValueString("Department")!=department,remove = remove + 1,""),"")
      @If(unit!="",@If(doc.getItemValueString("Unit")!=unit,remove = remove + 1,""),"")
      if(remove!=0) dc.deleteDocument(doc)
  
      doc.recycle();
  
  
      doc = tmpdoc;
  
      }
  
  return dc
  </code></pre>