cancel
Showing results for 
Search instead for 
Did you mean: 

Extract specific records after ODATA MODEL retrieved data from back end

former_member321020
Participant
0 Kudos

Hi Experts,

How to read specific data from the NAMED data model( here i have used V2 odata Model using XML view and MANIFEST file) once data is retrieved successfully from the backend. i am able to retrieve data using table.bindrows. This is all fine.

Now once data is available under NAMED data model, now i want to read specific records from this named data model. How to achieve this?

Thanks

Sashi

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos
oModel = this.getView().getModel("myModel");
oModel.read("/EntitySet", {success: function(oData){
                                        //do the required 
                                     }
                          });

You can call read method of odata model and after successfully reading data, the success call back function will get executed, inside this function you have the model data in the input parameter oData, which is a JavaScript object, now you can use this object to read any specific data.

Regards,

Rahul

former_member321020
Participant
0 Kudos

Hi Rahul,

If i do as suggested then how can i bind the data to table. i am first retrieving the data using TABLE.BINDROWS and displaying data in table. Once this is done then i want to extract data from NAMED model.

if i first retrieve data using oModel.read, then how can i bind the data to table from success call back function?

here is the scenario:

In the first page i have 3 different radio buttons which indicates different years like 2015,2016 and 2017. When i click on first radio button(2015), then odataModel brings the 2015 related data and stores in NAMED model. When i go back and click on second radio button(2016), then odataModel brings the 2016 related data and stores 2016 ALONG WITH 2015 data in NAMED model. But i want only 2016 data to be available in the named model(not 2015 data). How to achieve this?

Thanks

sashi

Former Member
0 Kudos

Use filters in odata service.