title: SAPUI5: Detail View Controller - Access Data
body: <p>I'm stuck with my little UI5 app. It's a master/detail app with the according 2 views. I want to get access to the selected data set inside the detail controller. The view and the app itself work. I can display the data inside the detail view.</p>
  
  <p>But I need the data in the controller. I spent hours reading and I'm sure it must be very simple.</p>
  
  <p>Inside the detail controller in the <code>handleRouteMatched</code> I defined a new variable <code>var dataObject = this.getView().bindObject(oPath);</code></p>
  
  <p>When I debug the <code>dataObject</code> I see that the data is there (but all data not just the selected). It's deep inside the "undefined"
  <a href="https://i.stack.imgur.com/kyr0i.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kyr0i.png" alt="Chrome Debugger Picture"></a></p>
  
  <p><a href="https://i.stack.imgur.com/ei75U.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ei75U.png" alt="Chrome Debugger 2"></a>
  And I have no clue how to get hold of this. Can someone help?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <pre><code>var sContext = this.getView().oController.sContext; //Retrieve context
  var oModel = this.getOwnerComponent().getModel(); // Aquire the model
  console.log(oModel.getProperty("/" + sContext + "/Businesstravel"));
  </code></pre>
  
  <p>That's how I finally got it working. It would have been nice to get the whole record though (not only single fields).</p>