on 03-25-2019 6:11 PM
Hi,
I just started doing some exercise on SAPUI5, here is my problem description:
I have an objectHeader control which i have binded with Entity_A using bindElement. However i want to bind another value from Entity_B to one of the objectHeader property. How do i do that?
I have set up my on-premise SAP odata service as data source, which verified works in binding to controls (and verified via other exercise). My Manifest.json as following:
"OData":{ "dataSource" : "D30" } --> the destination is properly set up in Hana Cloud Platform Destination setting
-----------------------------------------------
so far, I have tried following:
1. in view controller, getting the value from Entity_B from OData model. Something like following :
var oModel = new sap.ui.model.odata.ODataModel("https://my.sapdomain.com/sap/opu/odata/sap/MYODATA_SRV/"); <--full URL
var value = oModel.getProperty("OData>/EntitySet_B('ABC')/value");
------------------------
2. Also tried accessing Odata model in manifest.json
var oModel = new sap.ui.model.odata.ODataModel("OData"); <-- data source predefined in manifest.json
var value = oModel.getProperty("OData>/EntitySet_B('ABC')/Value")
------------------------
3. Also tried
val value = oModel.read("OData>/EntitySet_B('ABC')/value", { success: function(odata,response){ ... }, error: function(error){ } });
------------------------
4. I haven't tried to instantiate OData model object with "destinations/D30". Which it probably use the ready-set credential to access my Odata service
How do i use instantiate Odata model object using "destination/D30" (which contain the service URL)?
Anybody have any other idea?
Regards
Zen
Hi,
You can simply use named models.
You can name the models.
Your objectHeader code will look like below:
<ObjectHeader binding="{entityA>/ProductCollection}" title="{Name}">
<attributes>
<ObjectAttribute text="{entityA>WeightMeasure} {entityA>WeightUnit}" />
<ObjectAttribute text="{entityB>/Width} x {entityB>/Depth} x {entityB>/Height} {entityB>/DimUnit}" />
</attributes>
<ObjectHeader>
Hope it will help,
Best Regards,
Rajvardhan Thakare
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
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.