Skip to Content
Oct 16, 2016 at 04:40 PM

SAPUI5 single entity binding while using filters

1517 Views Last edit Oct 16, 2016 at 04:44 PM 2 rev

Dear Gurus

i created the below OData service that contains two entities

Then i created the app i started with the first view and the controller then in it i wrote the following code

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() ));"/tbl_Vendors", {
			filters : aFilter

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


6kdlh.jpg (149.2 kB)