Skip to Content
author's profile photo Former Member
Former Member

manipulating data returned by Odata service

Hi All,

https://sapui5.netweaver.ondemand.com/sdk/#docs/guide/ODataModel.html

As per the above link,

I could infer that OdataModel is a server side model .

Is it possible to manipulate the Odata result before feeding it to UI component ?

ie Example,

A Odata service returns a set of key values pairs ,i want to remove the rows for which description of key is not available

After removing the unwanted rows , i want to feed it to UI 5 table component

Fro another Odata service , i want to convert the json object into another json abject of desired structure before feeding it to Pie Chart component .

Is manipulation possible in Server side model like OdataModel?

Regards,

Madhumitha

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Nov 11, 2013 at 09:50 AM

    Hi Madhumitha,

    You can get the result into an array for maniuplate it. When you've got it, you can parse it to a custom array for do the data binding. This is an example:

    var auxArray = new Array();                    odmDataModel.read("/XXXXX",                                        null, null, false, function(oData, oResponse){                              auxArray = oData;                    });                    var myDataBinding = new Array();                    for(var i = 0; i < auxArray.length; i++){                              //SOME PARSE TO YOUR CUSTOM DATABINDING                    }                    var jsonModelCustomJSONModel = new sap.ui.model.json.JSONModel();                    jsonModelCustomJSONModel.setData({data: myDataBinding});                    table.setModel(jsonModelCustomJSONModel);                    table.bindRows("/data");

    Regards

    Jose Manuel

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 11, 2013 at 08:31 AM

    Hi Madhumitha,

    You can change the JSON object from one form to another form by using formatter .

    Please refer below link.

    https://sapui5.netweaver.ondemand.com/sdk/#docs/guide/BindingProperties.html

    Thanks&Regards

    Sridevi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 09, 2015 at 10:19 AM

    Hi ,

    I am working withe same kind of request.I need to assign the values of Odata model / JSON Model to an array.

    odmDataModel.read("/XXXXX",


    which value i have to give for XXXXX ??



    Thanks,

    Sandeep

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Madumitha ,

      My Odata URL will look like this,

      var url = "/xxx/xxx/services.xsodata/uid(xid=" + xid + ",y_id=" + y_id + ",xx_id=" + xx_id +

      ",yy_id=" + yy-id + ",xxx_id=" + sessionStorage.getItem("xxx_id") + ",yyy_id=" + sessionStorage.getItem(

      "yyy_id") + ")/Results/?$format=json";

      can you please which part is entity set in URL ?

      thanks,

      Sandeep

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.