Skip to Content
0
Former Member
Jun 21, 2016 at 05:11 PM

Problem formatting dimensions on a table

51 Views

Hi everyone,

I would like to know if there is an error in the following code I made for an example chart. I am just beginning with SAPUI5 so for me it is a little hard to know what the problem is.

If I use just the following code to the data set I can see the chart correctly:

var oDataset = new sap.viz.ui5.data.FlattenedDataset({
        dimensions: [{
          axis: 1,
          name: 'Fecha',
          value: "{Idate}"
        }],
        measures: [
          {
    group:1,
            name: 'Medida', 
            value: "{Readg}"
          }
         
        ],
        data: {
          path: "/PointsListSet('" + pointSel + "')/ToMeasures"
        }
      });

But if I try to use a formatter function as follows:

formater function:

dateFormat: function(iDate) {
  // SAPUI5 formatters  
  var dateFormat = sap.ui.core.format.DateFormat.getDateInstance({pattern : "dd/MM/yyyy"});   
  var dateStr = dateFormat.format(new Date(iDate.getDate())); //05-12-2012   

  return dateStr;
  }

New FlattenedDatase:

var oDataset = new sap.viz.ui5.data.FlattenedDataset({
        dimensions: [{
          axis: 1,
          name: 'Fecha',
          value: {
          path:'Idate',
      formatter: formatter.dateFormat
          }
        }],
        measures: [
        ....

and for the chart I get :

[50017] - Invalid data binding

What could be the cause of this binding error if all I did was to change the value in Dimensions to add a formatter and I try this to format the same values but for a table and it worked correctly.

Thank you all

Regards,