title: Pull specific field from nth index of Knockout observableArray of objects
body: <p>I have a page that displays a list of file templates built using the following method.</p>
  
  <pre><code>var loadCustomTemplate = function () {
      loadBaseTemplate();
      var res = 0;
      for (i = 0; i &lt; self.GetSeam().length; i++) {
          var a = self.count() + 1;
          self.count(a);
          res = self.GetSeam()[i].FileFormat.split("_");
          if (res.length == 4) {
              var ap = res[3].split('.');
              self.append(ap[0]);
          } else {
              self.append("");
          }
          var obj = {
              Code: ko.observable(self.code()),
              Number: ko.observable(self.number()),
              SeamReportPath: ko.observable(self.reportPath()),
              FileFormat: ko.observable(self.append()),
              SequenceNumber: ko.observable(a)
          }
          self.CustomTemplate.push(obj);            
      }
      self.count(0);
  }; 
  </code></pre>
  
  <p>The user is then allowed to edit the fields as needed.  They can also add records or remove them as needed. The method to add a record is as follows.</p>
  
  <pre><code>self.addTemplate = function () {      
      var count = self.CustomTemplate().length + 1;  
      var obj = {
          Code: ko.observable(self.code()),
          Number: ko.observable(self.number()),
          SeamReportPath: ko.observable(self.reportPath()),
          FileFormat: ko.observable(""),
          SequenceNumber: ko.observable(count)
      }
      self.CustomTemplate.push(obj)
  };
  </code></pre>
  
  <p>Once those updates are made they can save the updated CustomTemplate. This uses ajax that is not important to this question. The save method calls a validation method that is supposed to check to make sure there are no duplicate FileFormat fields in the object array.  This is what I have, but it is failing. </p>
  
  <pre><code>var validateTemplates = function() {
      for (i = 0; i &lt; self.CustomTemplate().length; i++) {
          var checkVal = self.CustomTemplate()[i].FileFormat;
          var checkSeq = self.CustomTemplate()[i].SequenceNumber;
          for (j = 0; j &lt; self.CustomTemplate().length; j++) {
            if (checkSeq !== self.CustomTemplate()[j].SequenceNumber ){  
              if (checkVal+"" === self.CustomTemplate()[j].FileFormat) {
                  if (checkSeq == self.CustomTemplate()[j].SequenceNumber ){
                      return false;
                  }
              }                   
          }
      }
      return true;
  };
  </code></pre>
  
  <p>The problem is that when checking self.CustomTemplate()[i].FileFormat and  self.CustomTemplate()[i].SequenceNumber it isn't reflecting the data displaying on the page or the data being sent to the controller (MVC 4). If I put either of those in an alert it is showing a function. How do I access the data in those specific fields for comparison?</p>
  
  <p>Thanks in advance. </p>