Skip to Content
0

Design studio script fixates filter

May 19, 2017 at 05:46 PM

64

avatar image
Former Member

Hi,

I am fairly new to design studio, and have some issues.

I am using a BEx Query as a data source, from a BW platform.

Given the structure of the BW I have created a script, so that my dashboard, default, shows the figures for the current period and current month. However my intention is that the user, can navigate the periods, usinga filter panel.


However my problem is, part of my script seem to fixate the default period, i.e. the dahsboard now reports the Financial figures from April 2017. While the year can be changed in the filter pane - the period is fixed to April. So one can see April 2016, 2015 etc. but Only april.

The script is as follows:

var CURR_Year = "K020" + Convert.subString(APPLICATION.getInfo().dateNow, Convert.stringLength(APPLICATION.getInfo().dateNow)-2);
DS_2.setFilter("0FISCYEAR",CURR_Year);
var monthNum = Convert.subString(APPLICATION.getInfo().dateNowInternalFormat, 4,6);
var monthNumber="";
var QTD="";
if (monthNum=="02") {monthNumber="01";} 
elseif(monthNum=="03") {monthNumber="02";}
elseif(monthNum=="04") {monthNumber="03";}
elseif(monthNum=="05") {monthNumber="04";}
elseif(monthNum=="06") {monthNumber="05";}
elseif(monthNum=="07") {monthNumber="06";}
elseif(monthNum=="08") {monthNumber="07";}
elseif(monthNum=="09") {monthNumber="08";}
elseif(monthNum=="10") {monthNumber="09";}
elseif(monthNum=="11") {monthNumber="10";}
elseif(monthNum=="12") {monthNumber="11";}
elseif(monthNum=="01") {monthNumber="12";}
var MTD="0"+monthNumber;
DS_2.setFilter("0FISCPER3", MTD);
DS_2.setFilterExt("ZSEGMENT", "75; 86");
10 |10000 characters needed characters left characters exceeded

Hi Thomas - would it be possible to share some screen shots of the BEx Query? On the surface, I am not sure I would this type of coding in Design Studio but it would help to see screen shots of the what you are trying to achieve in Design Studio and of the BEx query

Tammy

0
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Mustafa Bensan May 21, 2017 at 01:22 PM
0

Hi Thomas,

Further to Tammy's comments, when you post a question on the SCN, you should be very specific and very clear so that the community has enough information to understand/reproduce the issue and provide guidance accordingly. Here are some further questions and comments in this regard:

1. What version of Design Studio are you using?

2. What rendering mode are you using: SAPUI5 or SAPUI5 M?

3. In which event (and component if applicable) are you executing your script code?

4. What is the purpose of the filter on dimension "ZSEGMENT"?

5. You can considerably simplify your code as follows instead of using the long if-then statement:

var CURR_Year = "K020" + Convert.subString(APPLICATION.getInfo().dateNow, Convert.stringLength(APPLICATION.getInfo().dateNow)-2);

DS_2.setFilter("0FISCYEAR",CURR_Year);

var monthNum = Convert.subString(APPLICATION.getInfo().dateNowInternalFormat, 4,6);

var monthNum = Convert.stringToInt(Convert.subString(APPLICATION.getInfo().dateNowInternalFormat, 4,6));
monthNum = (monthNum == 1) * 12 + (monthNum > 1) * (monthNum - 1);
var MTD = Convert.floatToString(monthNum, "000");

DS_2.setFilter("0FISCPER3", MTD);
DS_2.setFilterExt("ZSEGMENT", "75; 86");

Regards,

Mustafa.

Share
10 |10000 characters needed characters left characters exceeded