arrays in design studio 1.3

12

Click here to load reader

Upload: raviskumar2005

Post on 02-Jun-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Arrays in Design Studio 1.3

8/10/2019 Arrays in Design Studio 1.3

http://slidepdf.com/reader/full/arrays-in-design-studio-13 1/12

 

September 15, 2014

Arrays in SAP Design Studio

1.3

 Author : Eshwar Prasanna V

Page 2: Arrays in Design Studio 1.3

8/10/2019 Arrays in Design Studio 1.3

http://slidepdf.com/reader/full/arrays-in-design-studio-13 2/12

Arrays in SAP Design Studio 1.3

Visual BI Solutions Inc. http://www.visualbi.com

TABLE OF CONTENTS 

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

Page 3: Arrays in Design Studio 1.3

8/10/2019 Arrays in Design Studio 1.3

http://slidepdf.com/reader/full/arrays-in-design-studio-13 3/12

Arrays in SAP Design Studio 1.3

Visual BI Solutions Inc. http://www.visualbi.com

IntroductionSAP 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 manipulatingarrays in Design Studio.

 About the Author

Eshwar Prasanna works at Visual BI Solutions as a BI Analyst. He has experience in handling

BusinessObjects tools such as Dashboards, Design Studio and Web Intelligence.

Page 4: Arrays in Design Studio 1.3

8/10/2019 Arrays in Design Studio 1.3

http://slidepdf.com/reader/full/arrays-in-design-studio-13 4/12

Arrays in SAP Design Studio 1.3

Visual BI Solutions Inc. http://www.visualbi.com

Design Studio ArraysWith the release of Design Studio 1.3, a host of new features were brought in by SAP. One of the most

useful, is the concept of Arrays. Though the versatility of this feature is quite limited in this release, SAP

has nevertheless offered certain aspects of Arrays that developers can play around with.

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 thedata 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:

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

Page 5: Arrays in Design Studio 1.3

8/10/2019 Arrays in Design Studio 1.3

http://slidepdf.com/reader/full/arrays-in-design-studio-13 5/12

Arrays in SAP Design Studio 1.3

Visual BI Solutions Inc. http://www.visualbi.com

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 isused, 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

String array can be created manually as well. This is shown in the screenshot below:

Page 6: Arrays in Design Studio 1.3

8/10/2019 Arrays in Design Studio 1.3

http://slidepdf.com/reader/full/arrays-in-design-studio-13 6/12

Arrays in SAP Design Studio 1.3

Visual BI Solutions Inc. http://www.visualbi.com

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.

Manipulating elements of an Array

Individual elements of an array can be accessed using the “forEach” loop. The basic syntax for this : 

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:

Page 7: Arrays in Design Studio 1.3

8/10/2019 Arrays in Design Studio 1.3

http://slidepdf.com/reader/full/arrays-in-design-studio-13 7/12

Arrays in SAP Design Studio 1.3

Visual BI Solutions Inc. http://www.visualbi.com

  “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 theelements 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:

Array Type Methods belonging to “element” object 

DimensionArray 1.  name  – Returns the technical name of

the dimension

2.  text  – Returns the text

(description/display name) of the

dimension 

HierarchyArray 1. 

name  – Returns the technical name of

the hierarchy 2.

 

text  – Returns the text

(description/display name) of the

hierarchy 

MemberArray 1.  externalKey  – Returns the representation

of the member as an external key

2.  externalNonCompoundedKey   – Returns

the representation of the member as an

external non-compounded key

3. 

internalKey  – Returns the

representations of the member as an

internal key

4.  internalNonCompoundedKey  – Returns

the representation of the member as an

internal non-compounded key

5.  text  – Returns the representation of the

member as a text (display name)

BookmarkArray 1. 

name  – Returns the name of the

bookmark

2. 

text  – Returns the text

(description/display name) of the

bookmark.

VariableArray 1. 

inputEnabled  – Returns true of the

variable is enabled, and false if otherwise

2.  name  – Returns the representation of the

variable as its technical name

3.  text  – Returns the representation of the

variable as its display name

StringArray 1. 

indexOf   – Returns the positions of

occurrence of a string being searched for

Page 8: Arrays in Design Studio 1.3

8/10/2019 Arrays in Design Studio 1.3

http://slidepdf.com/reader/full/arrays-in-design-studio-13 8/12

Arrays in SAP Design Studio 1.3

Visual BI Solutions Inc. http://www.visualbi.com

in the array.

2.  length  – Number of characters in the

array

3.  split  – Splits the string according to a

given separator4.

  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) 

Examples of Arrays in use

The program below takes a String array, eliminates the word “WORLD” and returns the remaining

elements of the StringArray as one concatenated string, in an application alert window.

The result of this program is an alert window shown below.

Page 9: Arrays in Design Studio 1.3

8/10/2019 Arrays in Design Studio 1.3

http://slidepdf.com/reader/full/arrays-in-design-studio-13 9/12

Arrays in SAP Design Studio 1.3

Visual BI Solutions Inc. http://www.visualbi.com

Dimension Arrays in Use:

Given below is an example of dimension arrays in use. Consider the dimensions of the data source

arranged in the manner shown in the screenshot below:

The script below exhibits the different ways in which the “getDimensions()” function can be used: 

var Dim_Array_Rows = DS_1.getDimensions(Axis.ROWS);var Dim_Array_Cols = DS_1.getDimensions(Axis.COLUMNS);var Dim_Array_Free = DS_1.getDimensions(Axis.FREE);var Dim_Array_All = DS_1.getDimensions();

var Rows = "";var Cols = "";var Free = "";var Overall = "";

Dim_Array_Rows.forEach(function(element, index) {Rows = Rows + element.name +" ("+element.text+");";

});

Page 10: Arrays in Design Studio 1.3

8/10/2019 Arrays in Design Studio 1.3

http://slidepdf.com/reader/full/arrays-in-design-studio-13 10/12

Arrays in SAP Design Studio 1.3

Visual BI Solutions Inc. http://www.visualbi.com

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:

Hierarchy Arrays in Use:

Given below is an example of hierarchy arrays in use. Observe the different hierarchies available for the

dimension “ZREGION” in the structure of the query shown in the screenshot below: 

Page 11: Arrays in Design Studio 1.3

8/10/2019 Arrays in Design Studio 1.3

http://slidepdf.com/reader/full/arrays-in-design-studio-13 11/12

Arrays in SAP Design Studio 1.3

Visual BI Solutions Inc. http://www.visualbi.com

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:

var Dim_Hierarchy = DS_1.getHierarchies("ZREGION");

var Hierarchy = "";

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:

Page 12: Arrays in Design Studio 1.3

8/10/2019 Arrays in Design Studio 1.3

http://slidepdf.com/reader/full/arrays-in-design-studio-13 12/12

Arrays in SAP Design Studio 1.3

Visual BI Solutions Inc. http://www.visualbi.com

DISCLAIMERInformation 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 ofthis documentation.

This is intended to be a living document with changes to be made over time.