on 02-01-2017 1:48 PM
Hi,
I am trying to get data to my Viz Chart.
My code looks like this:
First getting the data from oData (testing now with hard coded value) and putting it to json format:
var oVizFrame = this.oView.byId("idVizFrame");
var oVizModel = new sap.ui.model.json.JSONModel();
var strUrl = "http://xxxxxxxxxxxxxxx/sap/opu/odata/sap/ZOC_SRV/SalesOrderHdrSet('60008432')/SalesOrderToItems/?$format=json";
oVizModel.loadData(strUrl);
var oDataset = new sap.viz.ui5.data.FlattenedDataset({
dimensions: [{
name : 'Quantity',
value : "{OrderedQty}"}],
measures : [{
name : 'Value',
value : '{Value}'}],
data : {
path : "/SalesOrderItemSet"
}
});
When I look at oVizModel I do not see the data in the debugger, that is the first problem. The the second question, should I rather use oData model instead of json and if so, how?
Thanks,
Tim
Hi Tim,
For your first question - Since your json model gives the above json content, you have to mention your data path as "/d/results" instead of "/SalesOrderItemSet". The data will be displayed.
var oDataset =newsap.viz.ui5.data.FlattenedDataset({
dimensions:[{name:'Quantity',value:"{OrderedQty}"}],
measures :[{name:'Value',value:'{Value}'}],data:{
path :"/d/results"}});
For second question - You can either you json model or Odata model depends on you use case.
Thanks,
Surya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
10 | |
9 | |
8 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.