cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAC Application Design - date range filtering

Former Member
0 Kudos
4,850

Hello!

My question is very similar to this: SAC show two date periods using 1 date (story or page) filter and I was able to do so by using the date ranges filter on the restricted measures. My issue now is how would that happen if I'm gonna do it on application designer? I noticed that in the application designer, the date ranges filter is set to the current system date. My goal is to have the date be set by the user (custom input). I'm thinking of using the timerange function but I don't think that it will solve the problem.

Any help is appreciated. Thank you!

View Entire Topic
Alex_B
Participant

Hi forest_green,

I stumbled over your question. I was also searching for a date input possibility in application designer. Now I got one. It's not the fanciest but maybe it helps you too.

I created two Input Fields for the start and the end of the time range and a button for the execution.

Code of Button "Set period":

var date_start = InputField_start.getValue();
var date_end = InputField_end.getValue();
var day_start = ConvertUtils.stringToInteger(date_start.substring(0,3));
var day_end = ConvertUtils.stringToInteger(date_end.substring(0,3));
var month_start = ConvertUtils.stringToInteger(date_start.substring(3,6));
var month_end = ConvertUtils.stringToInteger(date_end.substring(3,6));
//in javascript month starts with 0 not 1, so you have to do -1
var month_start_conv = month_start-1;
var month_end_conv = month_end-1;
var year_start = ConvertUtils.stringToInteger(date_start.substring(6,10));
var year_end = ConvertUtils.stringToInteger(date_end.substring(6,10));
var range = TimeRange.create(TimeRangeGranularity.Day, new Date(year_start,month_start_conv,day_start),new Date(year_end,month_end_conv,day_end));
console.log(range);
Chart_1.getDataSource().setDimensionFilter("0CALDAY",range);
0 Kudos

Hi Alex,

I too stumbled across this thread! I've had a similar requirement in the past which has presented once again this week. I've created the following simple example via a button onSelect -

Once I run, as per previous attempts, it errors as follows -

Have you experienced anything similar or have any insights?

Thanks

Patrick

Alex_B
Participant
0 Kudos

Hi patrick99,

could you share pls the resultset of the dimension "2CLX..."

BR Alex

0 Kudos

Hi Alex,

Apologies for my delayed response.

Thanks

Patrick

Alex_B
Participant
0 Kudos

Hi patrick99

I am not sure I need to see more details. Could you provide more error details from {type: and from {action: maybe. I need to see which values he couldnt fetch. But first you have to check if the Dimension 2CLX..is able to handle timeranges. In other words if the Dimension has a Dynamic Date Calculation.

BR Alex

0 Kudos

Thanks Alex, please see below.

Alex_B
Participant
0 Kudos

Sorry patrick99 for late response. I didnt get a notification.

Is it possible to set a TimeRange Filter manually in the Chart with that Dimension or can you only filter via Members?