title: How can I filter my fetched data and load into tableview?
body: <p>I am using Firebase database. I fetched the data and want to filter and display only the information that matches the users selection. </p>
  
  <p>I have used a conditional statement to look for the matched value and append the list, however, I cannot get the table to load. When I print the variable, it prints 0. Need help thanks. </p>
  
  <pre><code>   override func viewDidLoad() {
      super.viewDidLoad()
  
      projectlbl.text = "Brand: \((repair?.brand)!) Model: \((repair?.modelNumber)!)"
  
      refResources = Database.database().reference().child("resources");
  
  
      let selectedProject = "\((repair?.modelNumber)!)"
  
  
      //observing the data changes
      refResources!.observe(DataEventType.value, with: { (snapshot) in
          //if the reference have some values
          if snapshot.childrenCount &gt; 0 {
  
              //clearing the list
              self.resourceList.removeAll()
  
              //iterating through all the values
              for resources in snapshot.children.allObjects as! [DataSnapshot] {
                  //getting values
                  let resourceObject = resources.value as? [String: AnyObject]
                  let id  = resourceObject?["id"]
                  let RSSSubCat  = resourceObject?["RSSSubCat"]
                  let RSSBrand = resourceObject?["RSSBrand"]
                  let RSSModelNumber = resourceObject?["RSSModelNumber"]
                  let RSSTitle = resourceObject?["RSSTitle"]
                  let RSSUrl = resourceObject?["RSSUrl"]
  
                  //creating resource object with model and fetched values
                  let resource = resourceModel(id: id as! String?, RSSSubCat: RSSSubCat as! String?, RSSBrand: RSSBrand as! String?, RSSModelNumber: RSSModelNumber as! String?, RSSTitle: RSSTitle as! String?, RSSUrl: RSSUrl as! String?)
  
                  //appending it to list
                  print(snapshot.childrenCount)
  
                  if selectedProject == resource.RSSModelNumber {
                      print(selectedProject)
                      self.resourceList.append(resource)
                      self.diagResTable.reloadData()
                  } else {
                      return
                  }
  
              }
  
              //reloading the tableview
              self.diagResTable.reloadData()
          }
      })
  </code></pre>