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

SAC Script api: can I work with story filter by using scripting

kumkej
Explorer
10,602

I have the problem that I would like to access the global story filters of the story via scripting. Do I have the possibility to read these values via a get function and can I also set the filters via a function? ....getDataSource().getDimensionFilters(...) is not even showing me the selected filter values of the story filter.

Thank you for your help

Accepted Solutions (0)

Answers (5)

Answers (5)

CasCriel79
Participant

Hi, I think this is not possible due to the fact that you are working in a specific page (at least when we are talking about the unified story). However, I noticed that SAP put this in the roadmap for the next quarter. This will open a lot of new opportunities! 🙂

William_Yu1
Product and Topic Expert
Product and Topic Expert

Right, 2023 QRC3 update will provide the exact API you need to get and set value for story filter .

brian_jespersen
Explorer
0 Likes

Hi

What is the name of this API and how to use it?

N1kh1l
Active Contributor

brian.jespersen

Its discussed in below blog, Chapter Script API for Story Filter Bar

https://blogs.sap.com/2023/06/22/whats-new-in-sap-analytics-cloud-release-2023.13/#3

Nikhil

Sebastian_Gesiarz
Active Participant
0 Likes

I can confirm the below works well to fetch the selection;

var selectedFilterValues = Application.getFileDataSource("MODELID").getDimensionFilters("DIMENSIONID");
stefan_dufter
Explorer
0 Likes

try this:

var modelID="Cl7s7e1rj7i8amn7vo60oqj40d";     // your model id
var dimensionID = "0PROFIT_CTR";              // your filter dimension

var selectedFilterValues = Application.getFileDataSource(modelID).getDimensionFilters(dimensionID);
console.log(selectedFilterValues);

 

 

stefan_dufter
Explorer
0 Likes
ups sorry, didn't read the other answers first...
eeddggaarr
Contributor
0 Likes

hi,
if you would like to get filter values from linked analysis please vote for this improvement request.

br
edgar

tablespace
Explorer
0 Likes

kumkej Until now it´s not possible to read the selected values from an Story Filter directly. But, you can use a workaround based on the cascading filter effect of story filters.

1. Create your Story Filter and ensure the cascading effect is enabled

2. Create a Input Control (IPC) for the same DIM on the page you would like to integrate the Script. (You can disable all links of the IPC to other widgets and you can hide the IPC, because it is only a "helper" IPC.

3. Now you´re able to read the selections via script from the Story Filter via the IPC, because there are the same entries selected, caused by the cascading effect of the Story Filter.

Example:

//Story Filter on DIM "Date"
//InputControl(IPC) on DIM "Date" as well - now you can read the Date selections from your Story Filter

var sel_date = IPC_1.getInputControlDataSource().getActiveSelectedMembers();
console.log("sel_date");
console.log(sel_date);
N1kh1l
Active Contributor
0 Likes

kumkej

kumkejIn responsive layouts the API's return blank but if its a canvas layout ...getDataSource().getDimensionFilters(...) should return the filter values.

Hope this helps

Nikhil