title: Enter a child node to get required information to enter another child node
body: <p>I'm trying to get the autoId that is written within the alert child node and turn this into a string in order to grab this autoId from the questions node to get the info inside it  - my code runs but doesn't print/work </p>
  
  <p>(the current user autoId is the first child of the alert node, and the userId is the string that comes from "objectId"/second child of questions). This is my code:</p>
  
  <pre><code>@IBOutlet weak var statementAnswered: UILabel
  @IBOutlet weak var number1Label: UIButton!
  @IBOutlet weak var number2Label: UIButton!
  @IBOutlet weak var number3Label: UIButton!
  @IBOutlet weak var number4Label: UIButton!
  
   guard let currentUser = Auth.auth().currentUser?.uid else { return }
   let ref = Database.database().reference()
  
      //enter alert node to get the new Id under the current user node
      let userRef = ref.child("alert").child(currentUser)
      userRef.observe(.childAdded, with: { (snapshot) in
          let uniqueKey = snapshot.key
          print(uniqueKey)
          guard let senderDetails = snapshot.childSnapshot(forPath: "from").value as? String else { return }
          guard let userID = snapshot.childSnapshot(forPath: "objectID").value as? String else { return }
          print(senderDetails)
          print(userID)
  
          let questionNotification = ref.child("questions").child(senderDetails).child(userID)
          questionNotification.observeSingleEvent(of: .value, with: { (snapshot) in
              let value = snapshot.value as? NSDictionary
              let statement = value?["statement"] as! String
              let number1 = value?["number 1"] as! String
              let number2 = value?["number 2"] as! String
              let number3 = value?["number 3"] as! String
              let number4 = value?["number 4"] as! String
              print(statement)
              print(number1)
              print(number2)
              print(number3)
              print(number4)
  
              self.statementAnswered.text = question
              self.number1Label.setTitle(number1, for: .normal)
              self.number2Label.setTitle(number2, for: .normal)
              self.number3Label.setTitle(number3, for: .normal)
              self.number4Label.setTitle(number4, for: .normal)
          })
      }, withCancel: nil)
  </code></pre>
  
  <p>Here is a snippet of the JSON structure:</p>
  
  <pre><code> "alert" : {
      "FjS4wUpXAUa5aWwXkjvujHxE4He2" : {
        "-La2uIRfXs15WP8bEfQo" : {
          "from" : "Gmg1ojNoBiedFPRNSL4sBZz2gSx2",
          "objectId" : "-La2uIRPzNXnamX4QLER",
          "timestamp" : 1552696293
        }
      }
    },
    "questions" : {
      "Gmg1ojNoBiedFPRNSL4sBZz2gSx2" : {
        "-La2uIRPzNXnamX4QLER" : {
          "number 1" : "4444",
          "number 2" : "1111",
          "number 3" : "2222",
          "number 4" : "3333",
          "statement" : "favourite number",
          "selected" : "FjS4wUpXAUa5aWwXkjvujHxE4He2"
        }
      }
    },
  </code></pre>
  
  <p>Appreciate any help!</p>
  
  <p>UPDATE:</p>
  
  <p>I've updated the code and on the console it prints the following (autoId's of users on the app):</p>
  
  <pre><code>[Snap (CjeP35ceAQZJuUPhm7U1eF3Yq4F3) 1, Snap 
  (FjS4wUpXAUa5aWwXkjvujHxE4He2) 1, Snap (FoFQDAGGX9hntBiBdXYCBHd8yas2) 
  1, Snap (PqMkClaPM3W8k7ZSgzAHb3yne5D3) 1]
  [Snap (CjeP35ceAQZJuUPhm7U1eF3Yq4F3) 1, Snap 
  (FjS4wUpXAUa5aWwXkjvujHxE4He2) 1, Snap (FoFQDAGGX9hntBiBdXYCBHd8yas2) 
  1, Snap (PqMkClaPM3W8k7ZSgzAHb3yne5D3) 1]
  [Snap (CjeP35ceAQZJuUPhm7U1eF3Yq4F3) 1, Snap 
  (FjS4wUpXAUa5aWwXkjvujHxE4He2) 1, Snap (FoFQDAGGX9hntBiBdXYCBHd8yas2) 
  1, Snap (PqMkClaPM3W8k7ZSgzAHb3yne5D3) 1]
  </code></pre>
  
  <p>(i'll keep trying to make my breakpoints work in order to see what's wrong and update it here if it works)</p>
  
  <p>Thanks in advance </p>
  
  <p>UPDATE:</p>
  
  <p>I've changed the structure of the database so that the "questions" don't get saved under the autoId of the currentUser (person answering questions) and instead it's just the random Id that is created and it works although i don't think its the most efficient way of doing it</p>