on 11-27-2017 7:40 PM
Hi everybody,
i'm trying to learn how dynamically I can use OData in SAP UI5 Applications.
My scenario is the following: I have an unknown number of OData-Sources defined in manifest.json. I want to get the metadata of the sources and read all available entitysets to have them as a list in a table.
Example:
odata_srv1 has the entitysets "businesspartners" and "loans"
odata_srv2 has the entitysets "cars" and "bikes
the table I want to have:
bikes
businesspartners
cars
loans
I want a table that lists all the entitysets of the defined odata-services, no matter if there is one or five services defined. Is this even possible?
Is there a method to get the defined data-sources in the manifest.json? Is there a method to read the entitysets from the sources?
Thank you so much!
Sidney
Hi Sidney Weiher,
How are you reading your service data. Is it from the manifest or the component file or from the controller itself. In any case you can use the getServiceMetadata() method with your model reference object, or you can use the $metadata query parameter to access all your service metadata.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sidney Weiher,
Could you try with :
this.getOwnerComponent().oModels // inside your controller's init method
As per my experimentation, you get an object which contains all the models defined in your manifest file.
Hope this helps,
Regards.
Thats what i needed. Thanks so much!
You can read the metadata loaded from your services, then you will be able to look for entitisets (look at this Link)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.