cancel
Showing results for 
Search instead for 
Did you mean: 

Display date range filtered in Bex query

Former Member
0 Kudos

I am looking for a way to display the date range

TEXT_27.setText(DS_1.getFilterText(min"0CALMONTH"))+ " - "+DS_1.getFilterText(max"0CALMONTH"));


Of course there is no min or max available but that's the logic I am trying to reach.

I have checked different threads such as

But they are all based on displaying a date range based on dropdown lists or filters from within design studio.

However in this case, the 0CALMONTH is already filtered by a variable in bex so there is no selection from within the design studio application.

Any ideas on how to display the minimum month and the maximum?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

If your "0CALMONTH" is in "yyyyMMdd" format then


use forloop here .




var MyDates = DS_1.getMembers("0CALMONTH",1000);


var MyDates_Count = MyDates.Length();

var MyDates_Min = "";

var MyDates_Max = "";

MyDates.foreach(function(MyDates_e, MyDates_i) {


if(MyDates_i==0){

var MyDates_Min = MyDates_e.text;

}

else if (MyDates_i==MyDates_Count){

var MyDates_Max = MyDates_e.text;

}


}


Former Member
0 Kudos

thanks, that's exactly what I needed.

Just a clarification, how do you display MyDates_Max?

because in this script, TEXT_2 only shows MyDates_Min:

var MyDates = DS_1.getMembers("0CALMONTH",1000);

var MyDates_Count = MyDates.length;

var MyDates_Min = "";

var MyDates_Max = "";

MyDates.forEach(function(MyDates_e, MyDates_i) {

if(MyDates_i==0){

MyDates_Min = MyDates_e.text;

}

else if (MyDates_i==MyDates_Count){

MyDates_Max = MyDates_e.text;

}

});

TEXT_2.setText(MyDates_Min+" - "+MyDates_Max);

0 Kudos

Hi Nikhil,

I have a similar requirement. But I do not have any variable defined in my BEX query.

I need to get the maximum 0CALMONTH value and then have to apply it as a filter to another BEX query.

Actually I am unable to get the maximum value. Can you please help me modify the above code a bit so that I can get the maximum value.

Thanks,

Shaunakh Sen

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Alexandre,

There is a function called DS_X.getVariableValue can you try that out?

Regards,

Fazith Ali Z.

Former Member
0 Kudos

Thanks, I was not aware of that function.

I have used it like this to display Max month:

TEXT_6.setText(DS_1.getVariableValueText("USCA_MONRANGE_FRSTD_CURRD").substring(9,17));