cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with ColumnMicroChart binding

Former Member
0 Kudos

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...




Accepted Solutions (1)

Accepted Solutions (1)

saivellanki
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

Hi Sai,

the hint with the formatter was the solution! Thanks a lot! For others with the same problems: The "/" in front of "AmountSum" had to be removed (as Dennis proposed) and appending "/results" to "ContractToAmountSums" leads to an URI-Error.

Kind regards,

Marko

Answers (1)

Answers (1)

former_member182862
Active Contributor
0 Kudos

{/AmountSum} should be {AmountSum} ?

Former Member
0 Kudos

I've tested that as well. I get one column, amount is 0 and no labels...