Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
Showing results for 
Search instead for 
Did you mean: 

In order to use fill in the Design Studio SDK: Leader Board Component I had to extend the Design Studio SDK: Collection Util Component by addition of extra generic parameters which can be passed to the collection and used as properties.

Now, you can use a new method which is returning an array with additional properties:

Scripting Functions

ScriptsShort Description

org.scn.pack.KeyLabelValueExtendedArray getAsKeyLabelValueExtendedArray (

  /**max members*/ optional int maxMembers)

returns the array with key, label, value + param1, param2, param3 which can be used as place holders for properties





var keysAndlabelsAsArray = COLLECTION_1.getAsKeyLabelValueExtendedArray(5);
// fill into the looser board
keysAndlabelsAsArray.forEach(function(element, index) {
  LOOSERBOARD.addElement(element.key, element.label + " ("+element.key+")", element.key + ".jpg", element.value, "" + element.param1);

How to Fill it in?

The set* and add* methods are extended by optional parameters,

ScriptsShort Description

void setItems (

  /*keys*/ String keys,

  /*labels*/ String labels,

  /*values*/ String values,

  /*separator*/ optional String separator,

  /*optional param 1 array*/ optional String param1s,

  /*optional param 2 array*/ optional String param2s,

  /*optional param 3 array*/ optional String param3s)

Sets items of the array by 2 strings: for keys, labels, values. Additionally sets also 3 optional arrays for parameters 1-3.

void addItem (

  /*key*/ String key,

  /*label*/ String label,

  /*value*/ float value,

  /*optional param 1*/ optional String param1,

  /*optional param 2*/ optional String param2,

  /*optional param 3*/ optional String param3)

Adds a value to new or existing array. Additionally sets also 3 optional values for parameters 1-3.

Connecting to other elements

Now, by this you can make more comprehensive loops and save more properties in the collection (which are also sorted):

allMembers.forEach(function(member, index) {
  var memberKey = member.internalKey;
  var memberText = member.text;
  var dataCell = DS_1.getData("4FW8C4WXM3HULQ4M1YPFT79EF", {
  "0BC_PERS1": memberKey
  if(dataCell.formattedValue != "") {
  var value = dataCell.value;
  var formattedValue = dataCell.formattedValue;
  COLLECTION_1.addItem(memberKey, memberText, value, formattedValue);
// leaders
var keysAndlabelsAsArray = COLLECTION_1.getAsKeyLabelValueExtendedArray(5);

In the example above, also "formattedValue" is now part of the array and can be used later in this script:

keysAndlabelsAsArray.forEach(function(element, index) {
  LEADERBOARD.addElement(element.key, element.label + " ("+element.key+")", element.key + ".jpg", element.value, "" + element.param1);

I hope this helps to handle more complex top/bottom scenarios now.

Example Application

A live application is available in GitHub, of course you have to change the system and query to some compatible query.

GitHub Access

An Application with example can be downloaded at the BIAPP Repository: