cancel
Showing results for 
Search instead for 
Did you mean: 

Getting data from different entity sets from back-end at once

Former Member
0 Kudos

Hello Experts,

I have created a custom Fiori app. My requirement is when I press a Add button, a form opens in which the user needs to fill data in the drop-downs. Each drop-down will get the data from different entity sets from ODATA. I am using filter method to fetch data.Since the control is going to back-end multiple times(for each drop down list), the time consumed is more (approx 2 mins). Is there any way by which I can get the data in one go and make the operation of loading Add page faster?

Accepted Solutions (1)

Accepted Solutions (1)

former_member190010
Contributor
0 Kudos

Hi Priya,

I think you can improve the speed of the app by using the concept of Batch Requests.

The idea is to group several odata requests, in just one.

Look at the following posts:

http://a248.g.akamai.net/n/248/420835/ebe99b9aeed591f15027250d4d925207e4b31882d83ffaf1748cb6c3c45307...

Also, when developing the odata services, try to follow the best practices listed in the following post:

Regards,

Emanuel

Former Member
0 Kudos

Hi Emanuel,

I used the concept of Batch Requests and grouped several odata requests. I am getting the data from back-end. The code what I used is below.

var omodel = this.getView().getModel();

var that = this.getView().getController();

var batchChanges = [];

batchChanges.push(omodel.createBatchOperation(

  "/entitySetName?$filter=Value+eq+'xyz'",

  "GET"));

  batchChanges.push(omodel.createBatchOperation(

  "/entitySetName?$filter=Value+eq+'abc'",

  "GET"));

omodel.addBatchReadOperations(batchChanges);

omodel.setUseBatch(true);

omodel.submitBatch(function(data) {

sap.ui.commons.MessageBox.show(data.__batchResponses[0].__changeResponses.length + " contacts created", sap.ui.commons.MessageBox.Icon

  .SUCCESS,

  "Batch Save", sap.ui.commons.MessageBox.Action.OK);

}, function(err) {

  alert("Error occurred ");

  });

I need to bind the data to dropdowns(Select). Can you help me with this?

Regards,

Priya.

former_member190010
Contributor
0 Kudos

Priya,

Please open a new discussion in the proper forum for that topic.

This way, more people will be able to help you find the answer to that question.

Regards,

Emanuel

Answers (0)