<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: SAPUI5 single entity binding while using filters in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/sapui5-single-entity-binding-while-using-filters/qaa-p/370901#M28490</link>
    <description>&lt;P&gt;you have to check your backend code to see if filtering is done properly there.&lt;/P&gt;</description>
    <pubDate>Tue, 18 Oct 2016 13:41:54 GMT</pubDate>
    <dc:creator>junwu</dc:creator>
    <dc:date>2016-10-18T13:41:54Z</dc:date>
    <item>
      <title>SAPUI5 single entity binding while using filters</title>
      <link>https://community.sap.com/t5/technology-q-a/sapui5-single-entity-binding-while-using-filters/qaq-p/370895</link>
      <description>&lt;P&gt;Dear Gurus&lt;/P&gt;&lt;P&gt;i created the below OData service that contains two entities&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1797-6kdlh.jpg" /&gt;&lt;/P&gt;&lt;P&gt;Then i created the app i started with the first view and the controller then in it i wrote the following code&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;onLogin: function(){
		var sURI = "proxy/http/localhost:9999/MIKMOWCFDataService.svc/";
		var oModel = new sap.ui.model.odata.ODataModel(sURI, false);
		oModel.oHeaders = {
			"DataServiceVersion": "2.0",
			"MaxDataServiceVersion": "2.0"
		};
		var aFilter = [];		
		aFilter.push(new sap.ui.model.Filter("VendorEmail", sap.ui.model.FilterOperator.EQ, this.getView().byId("txtUserName").getValue()));
		aFilter.push(new sap.ui.model.Filter("VendorPassword", sap.ui.model.FilterOperator.EQ,this.getView().byId("txtPassword").getValue() ));
		oModel.read("/tbl_Vendors", {
			filters : aFilter
		});
		sap.ui.getCore().setModel(oModel,"vendors");		
	}&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;What i'm trying to achieve from the code is to get the user id after he submits his email and password i managed to return the correct row from the DB but after that i was not able to read the ID property from the returned data it's only done through using list and press on the list item to fire another event and then read the ID which is not reasonable in the giving example can any one help me on how to read the property directly from the model Thanks in advance&lt;/P&gt;</description>
      <pubDate>Sun, 16 Oct 2016 16:40:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sapui5-single-entity-binding-while-using-filters/qaq-p/370895</guid>
      <dc:creator>karim_mohamed2</dc:creator>
      <dc:date>2016-10-16T16:40:49Z</dc:date>
    </item>
    <item>
      <title>Re: SAPUI5 single entity binding while using filters</title>
      <link>https://community.sap.com/t5/technology-q-a/sapui5-single-entity-binding-while-using-filters/qaa-p/370896#M28485</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;oModel.read("/tbl_Vendors", {filters: aFilter
		,success:function(oData,resonse){
//you should be able to get it from oData




}});&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 17 Oct 2016 01:07:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sapui5-single-entity-binding-while-using-filters/qaa-p/370896#M28485</guid>
      <dc:creator>junwu</dc:creator>
      <dc:date>2016-10-17T01:07:22Z</dc:date>
    </item>
    <item>
      <title>Re: SAPUI5 single entity binding while using filters</title>
      <link>https://community.sap.com/t5/technology-q-a/sapui5-single-entity-binding-while-using-filters/qaa-p/370897#M28486</link>
      <description>&lt;P&gt;Dear Jun Wu &lt;/P&gt;&lt;P&gt;Thanks for your reply&lt;/P&gt;&lt;P&gt;I tried your code and added the following lines&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;var bUser = oModel.getProperty("/VendorID");
				alert(bUser);&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;but it returned undefined &lt;/P&gt;&lt;P&gt;and one more thing how to pass the oData and the response parameters &lt;/P&gt;&lt;P&gt;Thanks in advance &lt;/P&gt;</description>
      <pubDate>Mon, 17 Oct 2016 11:01:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sapui5-single-entity-binding-while-using-filters/qaa-p/370897#M28486</guid>
      <dc:creator>karim_mohamed2</dc:creator>
      <dc:date>2016-10-17T11:01:43Z</dc:date>
    </item>
    <item>
      <title>Re: SAPUI5 single entity binding while using filters</title>
      <link>https://community.sap.com/t5/technology-q-a/sapui5-single-entity-binding-while-using-filters/qaa-p/370898#M28487</link>
      <description>&lt;P&gt;you don't have to do anything, that is callback function, "they" will fill the odata for u.&lt;/P&gt;&lt;P&gt;put a breakpoint in that method, and put oData in the console, you will see &lt;/P&gt;</description>
      <pubDate>Mon, 17 Oct 2016 13:48:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sapui5-single-entity-binding-while-using-filters/qaa-p/370898#M28487</guid>
      <dc:creator>junwu</dc:creator>
      <dc:date>2016-10-17T13:48:40Z</dc:date>
    </item>
    <item>
      <title>Re: SAPUI5 single entity binding while using filters</title>
      <link>https://community.sap.com/t5/technology-q-a/sapui5-single-entity-binding-while-using-filters/qaa-p/370899#M28488</link>
      <description>&lt;P&gt;I have also same kind of requirement.&lt;/P&gt;&lt;P&gt;@Karim: Please let me know if you could able to get the filtered data.&lt;/P&gt;&lt;P&gt;@Jun Wu: I can see all the entries in console in oData. Not the filtered one.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Oct 2016 18:48:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sapui5-single-entity-binding-while-using-filters/qaa-p/370899#M28488</guid>
      <dc:creator>former_member203070</dc:creator>
      <dc:date>2016-10-17T18:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: SAPUI5 single entity binding while using filters</title>
      <link>https://community.sap.com/t5/technology-q-a/sapui5-single-entity-binding-while-using-filters/qaa-p/370900#M28489</link>
      <description>&lt;P&gt;Dear &lt;A href="https://answers.sap.com/users/4283/junwu5.html"&gt;Jun Wu&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Thanks for your caring but it seems that i have a problem in my code that doesn't retrieve the data but i manage to use another approach to get the data i used the below code &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;onLogin: function(){
		var myView = this.getView();
		console.log(myView);
		var myURL = "proxy/http/localhost:9999/MIKMOWCFDataService.svc/tbl_Vendors/?$filter=VendorEmail eq '"+this.getView().byId("txtUserName").getValue()+"' and VendorPassword eq '"+this.getView().byId("txtPassword").getValue()+"'";
		var myJson = new sap.ui.model.json.JSONModel();
		myJson.loadData(myURL);
		myJson.attachRequestSent(function(){
	          //alert("Sent!");
	     });
		myJson.attachRequestFailed(function(){
	          //alert("Failed!");
	     });
		myJson.attachRequestCompleted(function(){
			window.VendorID = myJson.getProperty("/d/0/VendorID");
			//alert(window.VendorID);
			if (window.VendorID === null || window.VendorID === undefined) {
				sap.m.MessageToast.show("The password id incorrect");
			}
		});
		
		myView.setModel(myJson); 	
	}&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;@&lt;A href="https://answers.sap.com/users/10029/parthasarathi.html"&gt;Partha Sarathi&lt;/A&gt; kindly check the code if it worked for you  &lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2016 09:15:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sapui5-single-entity-binding-while-using-filters/qaa-p/370900#M28489</guid>
      <dc:creator>karim_mohamed2</dc:creator>
      <dc:date>2016-10-18T09:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: SAPUI5 single entity binding while using filters</title>
      <link>https://community.sap.com/t5/technology-q-a/sapui5-single-entity-binding-while-using-filters/qaa-p/370901#M28490</link>
      <description>&lt;P&gt;you have to check your backend code to see if filtering is done properly there.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2016 13:41:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sapui5-single-entity-binding-while-using-filters/qaa-p/370901#M28490</guid>
      <dc:creator>junwu</dc:creator>
      <dc:date>2016-10-18T13:41:54Z</dc:date>
    </item>
  </channel>
</rss>

