on 11-27-2017 7:07 AM
Hi Folks,
We have 2 oData services configured in the destinations, manifest.json and neo-app.json.
Odata Services : First
Second : This service requires a parameter to be sent to the oData and display the relevant data in the view.
Value selected in the first service should be passed as the input parameter to the second service.
We have to write Queries for filtering only required data to be displayed in input fields.
The scenario is :
We have a drop down with certain values retrieved from oData service. If we select a value, the data to that particular value should be displayed in the below input fields. This data is present in another(second) oData service.
Please help me by giving a sample example to this scenario.
Regards,
Aravind.
Hi,
You can do as following.
// under manifest.json
// ************** under "sap.app" component *******************
"dataSources": {
"mainService1": {
"uri": "/yourFirstServicePath/",
"type": "OData",
"settings": {
"odataVersion": "2.0",
"localUri": "localService/metadata.xml"
}
},
"mainService2": {
"uri": "/secondServicePath/",
"type": "OData",
"settings": {
"odataVersion": "2.0",
"localUri": "localService/metadata.xml"
}
},
// ************** under "sap.ui5" -> "models" **************************
"": {
"dataSource": "mainService1",
"preload": true
},
"nw": {
"dataSource": "mainService2",
"preload": true
},
// **************************************************************
// Under neo-app.json specify 2 destinations
{
"path": "/FirstDestination",
"target": {
"type": "destination",
"name": "northwind"
},
"description": "NorthWind"
},
{
"path": "/SecondDestination",
"target": {
"type": "destination",
"name": "northwind"
},
"description": "NorthWind"
},
// ******************************************************************
// In controller use below code to get particular model.
var srvOneModel = this.getView().getModel(); // No name specified because under model also empty
var srvTwoModel = this.getView().getModel("nw"); // Name "nw" is mentioned in for another service under model
// Using these two model call .read to call your paricular entityset from particular odata service.
If this info is useful please mark it answered.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Aravind,
Please tell me what error you're getting?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
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.