Hi John,
The press is an event handler for a button. It works fine when I copy the values to separate fields and then push them into the table (oData update).
For Ex: The below code works
function updateDetails() { var oProduct = oModel.getData('/CarbonData('+selectedProductID+')'); oProduct.ID = sap.ui.getCore().byId("Id_m").getValue(), oProduct.Loc_ID = sap.ui.getCore().byId("loc_id_m").getValue(), oProduct.Label = sap.ui.getCore().byId("Label_m").getValue(), oProduct.Region = sap.ui.getCore().byId("Region_m").getValue(); oProduct.Country = sap.ui.getCore().byId("Country_m").getValue(); oProduct.City = sap.ui.getCore().byId("City_m").getValue(); oProduct.Emitter = sap.ui.getCore().byId("Emitter_m").getValue(); oProduct.Quarter = sap.ui.getCore().byId("Quarter_m").getValue(); oProduct.Carbon_Footprint = sap.ui.getCore().byId("Carbon_Footprint_m").getValue(); oModel.update('/CarbonData('+selectedProductID+')', oProduct, null, function(data) { sap.ui.commons.MessageBox.show("Product " + oProduct.ID + " Updated!", sap.ui.commons.MessageBox.Icon.SUCCESS, "Product Saved", sap.ui.commons.MessageBox.Action.OK); }, function(err) { //Error Callback: alert("Error occurred " + err.message); }) };
However, it fails when I try an update directly using the object and I get an error saying;
Request contains properties that do not exist in entity 'CarbonDataType'
Do you know why it returns "'" ??