on ‎2024 Jan 08 9:55 PM
Can Story custom date filter be controlled by scripts? if Yes, can you please provide the code? I am new to scripts.
Request clarification before answering.
Hey,
if you try to use this date filter by range:

It seems the method getActiveSelectedMembers is not supported for time filters. But:
If you use the "Filter by Member" you can use the script to control it with buttons or what ever you like.
To test it i used the BestRunJuice Model and I set up a chart, a button and the "Filter by Member":


The onClick event of the button executes the following script:
InputControl_1.getInputControlDataSource().setAllMembersSelected(); // to make sure to get all members
var members = InputControl_1.getInputControlDataSource().getActiveSelectedMembers(); // save all members in a variable
// that is the structure of a MemberInfo:
// {id: '[Date_703i1904sd].[YHM].&[201606]', dimensionId: 'Date_703i1904sd', description: 'Jun (H1/2016)', displayId: '201606'}
var selMembers = ArrayUtils.create(Type.MemberInfo); // create an empty Array
for(var j = 0; j<5; j ++){ // here you are free to select what ever you want
selMembers[j] = members[j+3]; // make sure not to select the first one because you would select "all" too
}
InputControl_1.getInputControlDataSource().setSelectedMembers(selMembers); // set the selectet Members<br>After executing the script it looks like this:

In the loop part you could also check for some properties of the MemberInfo like displayId. Maybe some regex magic can help here.
I hope that is what you are looking for
Regards
Felix
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 7 | |
| 6 | |
| 6 | |
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.