on 08-17-2015 8:15 AM
I have a OData Service in a SAP Backend which produces the following JSON output:
{
"d" : {
"ContractNumber" : "0000010000850",
"ContractCapital" : "150000.00",
"ContractCurrency" : "EUR",
"ProductTypeText" : "Hypothekendarlehen",
"Installment" : "1730.0000000",
"InstallmentUnit" : "EUR",
"Interest" : "3.5000000",
"DisbursementObligation" : "85000.00",
"DateOfNextPayment" : "\/Date(1440979200000)\/",
"AmountOfNextPayment" : "1881.67",
"PartnerNumber" : "1000000863",
"PartnerRoleText" : "Hauptdarlehenspartner",
"LanguageKey" : "DE",
"ContractToAmountSums" : {
"results" : [
{
"ContractNumber" : "0000010000850",
"AmountType" : "REP",
"AmountSum" : "3460.00"
},
{
"ContractNumber" : "0000010000850",
"AmountType" : "INT",
"AmountSum" : "341.25"
},
{
"ContractNumber" : "0000010000850",
"AmountType" : "FEE",
"AmountSum" : "1560.00"
}
]
}
}
}
The binding in the controller is as follows:
var sContractPath = "/" + oEvent.getParameter("arguments").contract + "?$expand=ContractToAmountSums";
var oHeaderContainer = this.getView().byId("headercontainer");
oHeaderContainer.bindElement(sContractPath);
And this ist the corresponding view part:
<suite:ColumnMicroChart
columns="{ContractToAmountSums}"
size="M">
<suite:columns>
<suite:ColumnData value="{/AmountSum}" label="{AmountType}" color="Error"/>
</suite:columns>
</suite:ColumnMicroChart>
The problem is - it does not work. With the above mentioned version I get three columns in the chart and the correct label but all amounts are 0. If I leave the "/" before "AmountSum" I only get one column and no labels. If I add a "/" before "AmountType" I get three columns with no label. This is totally strange. How can I get the correct amounts in the chart instead of 0? And why seems to be a difference regarding the "/" though the two properties are in the exact same position of the model?
It would be nice if someone could bring a bit light into the issue...
Hi Marco,
It should be columns="{ContractToAmountSums/results}"
Check the working sample, I have used the same model that you used - JS Bin - MicroBullet Chart
And the AmountSum value is a string in model, whereas value property accepts only float/integer. So, I have used a formatter function to convert it to float, you can check the same in code.
var myFormatter = {
formatNumber: function(v) {
return parseFloat(v);
}
}
Regards,
Sai Vellanki.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
{/AmountSum} should be {AmountSum} ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.