Professional Documents
Culture Documents
Arrays in SAP Design Studio 1.3: September 15, 2014
Arrays in SAP Design Studio 1.3: September 15, 2014
1.3
TABLE OF CONTENTS
Contents
Introduction .................................................................................................................................................. 2
About the Author .......................................................................................................................................... 2
Design Studio Arrays ..................................................................................................................................... 3
Manipulating elements of an Array .......................................................................................................... 5
Examples of Arrays in use ......................................................................................................................... 7
Dimension Arrays in Use: ...................................................................................................................... 8
Hierarchy Arrays in Use:........................................................................................................................ 9
DISCLAIMER................................................................................................................................................. 11
Introduction
SAP BusinessObjects Design Studio 1.3 offers a new feature in BIAL called “Arrays”. With the
advent of this feature, iteration, creation of arrays and access of elements within an array becomes
easier. This document explores this feature in detail and provides technical know-how on manipulating
arrays in Design Studio.
Considering the rather concise information available in the designer guide, it seemed useful to provide a
detailed overview of this feature. So, here goes !
There are 8 different types of arrays available – subtypes of the object “Array”. These include:
1. Dimension Array:
This subtype can contain a list of different dimensions belonging to a data source. A dimension
array can be created by referencing the “getDimensions()” method of a data source –
dimensions belonging to rows, columns, free characteristics or all dimensions available in the
data source can be obtained with this method.
2. Hierarchy Array:
This subtype can contain a list of hierarchies. While there is no way for a user to create a
hierarchy array manually, it can be created using the “getHierarchies()” method of a data
source. This returns a list of different hierarchies available for the dimension that has been
passed as parameter to the method.
3. Member Array: 3
This subtype can contain a list of members belonging to a dimension. It can be created using the
“getMembers()” method of a data Source. The method returns a list of members of a dimension
as an array. The dimension for which the members are required must be passed as a parameter
to the method.
4. Bookmark Array:
This subtype can contain a list of all bookmarks for an application. Such a type of Array can be
created using the “getAllBookmarks()” method of the “Bookmarks” object. When the method is
used, it returns all the available bookmarks for that particular application.
5. Variable Array:
This subtype can contain a list of variables. It can be created using the “getVariables()” method
of a data source. This method returns all the available variables of the data source for which the
method is being called.
6. String Array:
This subtype can contain a list of strings. Unlike the previously mentioned types of arrays, a 4
String array can be created manually as well. This is shown in the screenshot below:
Apart from user customizable string arrays, the “getSelectedValues()” and “getSelectedTexts()”
methods of a Multi-Select enabled List Box can also return values in the form of a String Array.
Using the “Split()” method will also return a String Array.
7. Integer Array:
This subtype can contain a list of integers. This type of an array can also be created manually by
users.
8. Float Array:
This subtype can contain a list of decimal point numbers or floats. This type of an array can also
be created manually by users.
5
The “forEach” loop iterates over each element of an array and executes the statements contained
within the body of the loop. In the above syntax:
“element” refers to the individual elements contained in the array, one at a time.
“index” refers to the index/position of that particular element within the array.
Each element object has its own set of methods to access attributes of that element, depending on the
array type. For instance, when handling a MemberArray, the external keys and internal keys of the
elements can be accessed through methods of the “element” object. A list of the different methods
available for each type of array has been given below:
in the array.
2. length – Number of characters in the
array
3. split – Splits the string according to a
given separator
4. substring – Returns a new string which is
a substring of the given string
(It should be noted that the “element” object does not have any methods for an Integer or a Float Array)
The script below exhibits the different ways in which the “getDimensions()” function can be used:
Dim_Array_Cols.forEach(function(element, index) {
Cols = Cols + element.name+" ("+element.text+");";
});
Dim_Array_Free.forEach(function(element, index) {
Free = Free + element.name+" ("+element.text+");";
});
Dim_Array_All.forEach(function(element, index) {
Overall = Overall + element.name+" ("+element.text+");";
});
APPLICATION.alert("Dimensions in Row:\n"+Rows+"\n\nDimensions in
Cols:\n"+Cols+"\n\nDimensions in Free
Characteristics:\n"+Free+"\n\nOverall:\n"+Overall);
The script shown in the above window consolidates a list of all the dimensions belonging to the data
source, and displays them on an alert window as shown in the output below:
The script below simulates a situation where in the hierarchies available in a particular dimension
(“ZREGION” in this case) are obtained and displayed on an alert dialogue as soon as the user clicks a
button present on the screen:
Dim_Hierarchy.forEach(function(element, index) {
Hierarchy = Hierarchy + element.name + " ("+element.text+");";
});
APPLICATION.alert("Hierarchies Available:\n"+Hierarchy);
The output, if hierarchies are available on the given dimension (which is the case here), should resemble
the screenshot shown below:
10
DISCLAIMER
Information provided in this document is intended to be used only as a learning aid. While Visual BI
Solutions has used reasonable care in compiling this document it does not warrant that this information
is error free. Visual BI Solutions assumes no liability whatsoever for any damages incurred by usage of
this documentation.
11