cancel
Showing results for 
Search instead for 
Did you mean: 

what should i write to replace the parameter highlighted in red color?

Former Member
0 Kudos

Dear Experts,

may i know what should i write to replace the parameter highlighted in red color? The screenshot is taken from sapui5 SDK for building bar graph. Thanks.

Regards,

Loh.

Accepted Solutions (1)

Accepted Solutions (1)

Virinchy
Active Contributor
0 Kudos

Hi Loh Chun Wooi,

The highlighted Line is referring to a JSON Model available at

https://sapui5.hana.ondemand.com/sdk/test-resources/sap/viz/demokit/dataset/bookstore_fiori/ByItemCi...

It should be replaced with any other models that can be used in the application.

Regards

Virinchy

Former Member
0 Kudos

Hi Virinchy, very thanks for quick respond. I know it can be replaced with any other model but may i know where can i find and fill it if i created with mock data? Is it i need to write myself or there is a file contain it that can let me copy and paste and replace the highlighted line? If yes, mind you suggest me where it is?

Second question is if i create the apps by connecting Gateway in order to expose the data in the front end, is it i need to change the highlighted row (var oModel = new sap.ui.model.json.JSONModel("test-resources/sap/viz/demokit/dataset/bookstore_fiori/ByItemCity_sum.json");)

instead of using JSON model? if yes, i am not sure whether i should change in this way (var oModel = new sap.ui.model (" ???"); )? And what parameter should i replaced with the question marks which i bold it? And where can i find it? Is it can find it in the metadata.xml which the 2 links that i highlighted?

Regards,

Loh.

santhu_gowdaz
Active Contributor
0 Kudos

not this one, you should call 1 entity set which is holds some value to display the bar chart.

And you can't use like this "new sap.ui.model (" ???"); ".

oData model, Json Model, XML Model- depending upon your requirement you should use these model.

APAIK, OData Model is used to call server side data, means to get data from server or to post data to server.

JSon Model is used for local data storage, Client side data storage purpose.

These are very basic things. Before Learn FIORI. Please have some basic knowledge on these.

Former Member
0 Kudos

Hi Santhosh,very thanks for sharing and corrected my wrong. Do you mind share with me the way to write the code to call the entity set which is holds some value?

Thanks and appreciated.

Former Member
0 Kudos

Hi Virinchy, do you have any idea on how to display the bar chart by using XML view? Do i need to send you the project zip file for you to refer? Really need your help as i have run out of idea.

Thanks

Private_Member_15166
Active Contributor
0 Kudos

Hi Loh,

In this example this link has been used.

https://sapui5.hana.ondemand.com/sdk/test-resources/sap/viz/demokit/dataset/bookstore_fiori/ByItemCi...

Just use this link in place of "test-resources/sap/viz/demokit/dataset/bookstore_fiori/ByItemCity_sum.json" which is highlighted by you.

If you are using SAP Gateway then write like this.

var oModel = new sap.ui.model.odata.ODataModel("hostname: Port/sap/opu/odata/sap/ZDC_TEST_SRV/");

or if Gateway is already integrated then this might also work.

var oModel = new sap.ui.model.odata.ODataModel("/sap/opu/odata/sap/ZDC_TEST_SRV/");

In place of this.

  var oDataset = new sap.viz.ui5.data.FlattenedDataset({
  dimensions: [{
  name: "Item Category",
  value: "{Item Category}"            //Entity
  }, {
  name: 'City',
  value: '{City}'                    // Entity
  }],
  measures: [{
  name: 'Revenue',
  value: '{Revenue}'
  }],
  data: {
  path: "/book"          // Provide here entitySetName
  }
  });

In this example JSON modelhas been used. Here in Gateway oData model has been used.

Regards

Dhananjay

Private_Member_15166
Active Contributor
0 Kudos

See this link

Answers (2)

Answers (2)

Private_Member_15166
Active Contributor
0 Kudos

Write like this and check.

oDataModel = new sap.ui.model.odata.ODataModel("host:port/sap/opu/odata/sap/ZPRODUCTTEST_SRV/");)

or check with adding proxy.

oDataModel = new sap.ui.model.odata.ODataModel("proxy/https/**********:port/sap/opu/odata/sap/ZPRODUCTTEST_SRV/");)

Private_Member_15166
Active Contributor
0 Kudos

Hi Loh,

If you have got the answer then Please mark this Discussion with a Correct Answer (closes, but does not lock the Discussion) and Helpful Answer where appropriate. Seehttp://scn.sap.com/community/support/blog/2013/04/03/how-to-close-a-discussion-and-why Even if you discovered the solution without any outside contributions, it helps others to understand what the solution turned out to be.  Do not use Assumed Answered as it confuses anyone looking for the specific answer.


Thanks, Dhananjay

Former Member
0 Kudos

Hi Dhananjay, i will follow the guidance and do it very soon.

Thanks ya

Former Member
0 Kudos

Hi Dhananjay, i followed your ways to connect to Gateway

(oDataModel = new sap.ui.model.odata.ODataModel("/sap/opu/odata/sap/ZPRODUCTTEST_SRV/");) , yet i get such error in console as shown. Do you faced this error before?

Private_Member_15166
Active Contributor
0 Kudos

Discussion Carried forward to this link.