cancel
Showing results for 
Search instead for 
Did you mean: 

How to get model from the app descriptor file and iterate the model?

VenkyM
Participant
0 Kudos

Hi all,

I am using SAP Web IDE and I have two json files and configured them in app descriptor as show below.

I want to get the model from app descriptor and iterate through JSON model and display data in a table from second.json file where Category1 is not equal to “0000” and category2 and category3 is equal to “0000” using first.json.

For the json two files “Type” property is common.

Please suggest me the idea and any help will be appreciated.

Manifest.json
...
"sap.ui5": {
		"_version": "1.1.0",
		"rootView": {
			"viewName": "com.test.ui5.view.Products",
			"type": "XML"
		},
		"dependencies": {
			"minUI5Version": "1.30.0",
			"libs": {
				"sap.ui.core": {},
				"sap.m": {},
				"sap.ui.layout": {}
			}
		},
		"contentDensities": {
			"compact": true,
			"cozy": true
		},
		"models": {
			"i18n": {
				"type": "sap.ui.model.resource.ResourceModel",
				"settings": {
					"bundleName": "com.test.ui5.i18n.i18n"
				}
			},
			"first": {
				"type": "sap.ui.model.json.JSONModel",
				"uri": "model/first.json"
				
			},
				"second": {
				"type": "sap.ui.model.json.JSONModel",
				"uri": "model/second.json"
				
			}
		
		},
		"resources": {
			"css": [{
				"uri": "css/style.css"
			}]
		}
	}
First.json
{
"Type":"A",
 "Category1":"0001",
 " Category 2":"0000",
 " Category 3":"0000",
},
{
"Type":"B",
"Category1": "0002",
" Category 2":"0000",
" Category 3":"0000",
}
... and so on..

Second.json:
{
"Type":"A",
"itemno": "2010",
" itemname":"Sugar",
},
{
"Type":"B",
"itemno": "2010",
" itemname":"Sugar",
} … and so on

Accepted Solutions (1)

Accepted Solutions (1)

junwu
Active Contributor
0 Kudos

in your controller, this.getOwnerComponent().getModel("first")

Answers (0)