Quantcast
Channel: SCN : Popular Discussions - RESTful Web Services SDK
Viewing all articles
Browse latest Browse all 1088

Supply dataset in dynamic way

$
0
0

Hi,

 

I would like to supply dataset in dynamic way.

 

I have a array (dataset_metadata) which contains metadata but I don't know how many metadata are in. I just know that the last metadata is the measure.

 

So can you help me to supply dataset in javascript?

 

For 3 metadata, the code is:

 

    var dataset = new sap.viz.ui5.data.FlattenedDataset({

        dimensions : [

            { axis : 1, name : dataset_metadata[0]["$"], value : "{" + dataset_metadata[0]["$"] + "}" },

            { axis : 2, name : dataset_metadata[1]["$"], value : "{" + dataset_metadata[1]["$"] + "}" }

        ],

        measures : [

            { name : dataset_metadata[2]["$"], value : '{' + dataset_metadata[2]["$"] + '}' }

        ],

        data : { path : "/data" }

    });

 

For x metadata, with a loop, the code is?

 

-----

 

Same question for the table:

 

var oTable = new sap.ui.table.Table({

columns : [ new sap.ui.table.Column({

  label : dataset_metadata[0]["$"],

  template : new sap.ui.commons.TextView({

  text : '{' + dataset_metadata[0]["$"] + '}'

  }),

  sortProperty : dataset_metadata[0]["$"],

  filterProperty : dataset_metadata[0]["$"],

  width : "100px"

}), new sap.ui.table.Column({

  label : dataset_metadata[1]["$"],

  template : new sap.ui.commons.TextView({

  text : '{' + dataset_metadata[1]["$"] + '}'

  }),

  sortProperty : dataset_metadata[1]["$"],

  filterProperty : dataset_metadata[1]["$"],

  width : "100px"

}), new sap.ui.table.Column({

  label : dataset_metadata[2]["$"],

  template : new sap.ui.commons.TextView({

  text : '{' + dataset_metadata[2]["$"] + '}'

  }),

  sortProperty : dataset_metadata[2]["$"],

  filterProperty : dataset_metadata[2]["$"],

  width : "100px"

}) ],

rows : "/data",

visibleRowCount : 12

});

 

How supply oTable with using a loop?

 

Best regards

 

Yannick


Viewing all articles
Browse latest Browse all 1088

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>