cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with accessing expanded data in an OData model

Former Member
0 Kudos

Hello,

I have an OData model which looks like this:

In a formatter function I try to access "ContractToResidualCapitals". This actually is a table with several entries and three columns. Unfortunately I cannot access that node in the model. If I use

var test1 = oModel.getProperty("/ContractSet('0000010000850')");

"test1" get's the correct object.

Trying

var test2 = oModel.getProperty("/ContractSet('0000010000850')/ContractCapital");

also leads to the expected result. But if I try

var test3 = oModel.getProperty("/ContractSet('0000010000850')/ContractToResidualCapitals");

"test3" is always "undefined". Furthermore I cannot see the data in the debugger (only "deferred") though they are visible in the UI (via an XML view). The three "ContractTo..." nodes are loaded via an "expand". Maybe that causes the problems.

Does anybody have an idea how to access the data in those three nodes?

Thanks & kind regards,

Marko

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member182372
Active Contributor
0 Kudos

ODataModel.prototype.getProperty = function(sPath, oContext, bIncludeExpandEntries)

Former Member
0 Kudos

Unfortunately it doesn't work:

var test2 = oModel.getProperty("/ContractSet('0000010000850')/ContractToResidualCapitals", null, true);


The result is the same as before. Or do I miss something here?

former_member182372
Active Contributor
0 Kudos

how do load data? explicetly or through binding?

Former Member
0 Kudos

Through binding.

former_member182372
Active Contributor
0 Kudos

dont mind sharing the format?

Former Member
0 Kudos

Sorry... 😉

The binding is updated in the controller of the view:

// update binding

var sContractPath = "/" + oEvent.getParameter("arguments").contract + " $expand=ContractToAmountSums,ContractToResidualCapitals";

var oHeaderContainer = this.getView().byId("headercontainer");

oHeaderContainer.bindElement(sContractPath);

former_member182372
Active Contributor
0 Kudos

try

oHeaderContainer.bindElement(sContractPath, { parameters: {expand:'ContractToAmountSums'} });

Former Member
0 Kudos

Hello Maksim,

sorry for the delay - I was absent a while...

I've tested your coding but unfortunately nothing has changed... In the debugger I only can see the "deferred" statement but no data.

Kind regards,

Marko

Former Member
0 Kudos

Can you post the value of 'sContractPath'  ? .  Also the view definition where you're using that formatter function ?

Former Member
0 Kudos

sContractPath has the value "/ContractSet('0000010000850')"

The line in the view looks as follows:

<suite:MicroAreaChartLabel label="{path: 'ContractNumber', formatter: 'util.Formater.firstX'}"/>

Former Member
0 Kudos

When formatter function is called, there is not guarantee that the expanded properties will be available in the model as you've haven't bound those to the label. A formatter is supposed to manipulate only the values that is bound to that corresponding control.

As you've said the expanded properties are visible in the UI, where are those bound in the view ? Just try having a formatter to those controls and you'd be able to get the values.

Former Member
0 Kudos

The actual problem is that I need to evaluate the whole model to be able to determine the label values. In my case the minimum and maximum sum and the minimum and maximum date which occurs for the respective contract  in the aggregation ContractToAmountSums. The MicroAreaChart seems to be a bit premature regarding the axes labels. I almost can't imagine a use case where they can be set to fixed value... 😉