Hello,
I want to invoke the following oData url from SAPUI5 controller.
/EmpSet('453233')/?$expand=EmpDetails
I am aware of oData model concepts and how to invoke normal read using oData model. However, I am struggling to invoke the above url with the value 4533233.
As far as I understood, I can invoke expand query using
oModel1.read("/EmpSet", {
urlParameters: {
"$expand": "EmpDetails"
}
});
How can I pass the value 453233 in the above code snippet..
Regards
Faddy
Request clarification before answering.
The code looks intact in my view.
As it never hits _fGetSuccess or _fGetError methods, can you check whether those methods are declared correctly in the controller? Or try to embed the success/error method within the read() method and see what happens
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Fahad,
If you open this query on a browser (give me all products where category is 1), it works:
http://services.odata.org/OData/OData.svc/Categories(1)/?$format=json&$expand=Products
So if you are able to open the following on your browser, your query must be correct:
http://<server>:<port>/EmpSet(453233)/?$format=json&$expand=EmpDetails
If it works on your browser, then it is a matter of calling the same on your controller. Have you tried this:
var emp_id = "453233";
oModel1.read("/EmpSet" + "(" + emp_id + ")", {
urlParameters: {
"$expand": "EmpDetails"
}
});
I believe "453233" is a numeric value to your odata service. If not, please add single-quotes to your variable.
Regards,
Ivan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
This is strange, it should be working like you wrote in your comment. Is the EmpSet is really an EntitySet ? (dumb question, but who knows ... ? 😉 )
Regards,
Joseph
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks everyone for your valuable suggestions.
Issue was that the method _fGetSuccess was misspelled in controller. It works now
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 5 | |
| 5 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.