on 07-13-2018 6:18 AM
Hi Everyone,
We are working on SAPUI5 Application Development. In my application scenario i need to to pass some values from my View to Gateway OData Service, it should return the EntitySet value. in oModel.read, i can read only single data (Entity not EntitySet) right?
How to achieve this?
Thank you,
Regards,
JK.
oModel.read can be used in both cases i.e. reading single entity or entityset
to read single entity, you need key of the entity. Below code might help to understand how that can be done:
var sPath = sEntitySetName + "(" + sKey + ")"; // sKey is the value of the key
oModel.read(sPath, {
success: function(data, response){
// your code to manipulate data received
}.bind(this)
error: function(response){
// error handling
}.bind(this)
});
use the code below for pass filter values. This will give array of the result set from backend
oModel.read(sPath, { // sPath - path of your Entityset
urlParameters:{
"$filter": "Field eq value" // the "Field" is the field in the entity set to put a filter on and its value,
//you can use eq, bt etc.
}
success: function(data, response){
//your code for manipulation of the data received
}.bind(this) // if you want to use the current controller instance within this function
error: function(response){
// for handling the error received
}.bind(this) // if you want to use the current controller instance within this function
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.