cancel
Showing results for 
Search instead for 
Did you mean: 

SAC Analytical Application Script to Select all in Input Control

stephlef
Participant

Dear Experts,

In an analytical application, I am looking for a way to reset some filters to the selection "All". For now I'm working with Input Controls (if you know a work around using other objects like filter line, I take it! already tried)

What I've done for now is an ugly work around: during onInitialization of the Canvas, I save members of the Input Controls I want to reset later, in global variables (member info, arrays):

init_members_Dimension1 = IC_Dimension1.getInputControlDataSource().getActiveSelectedMembers(99999);

When I want to reset these fitlers, I feed these input controls the values in the global variables.

IC_Dimension1.getInputControlDataSource().setSelectedMembers(init_members_Dimension1);

I see two problems of this method:

1. After resetting, the Input controls do not show neat "(All)", but a huge list of members

2. This is pretty ugly

Do you have any idea how to solve this?

Thanks a lot!

Stéphane

Accepted Solutions (1)

Accepted Solutions (1)

dohaidang_le
Participant

I hope the problem will be fixed with Release 2023.07. The "setAllMemberSelected" and "isAllMemberSelected" look quite promising. At least, you can check, before saving the selected members into an array, whether the "All" is selected. If yes, you can use another script variable to store the AllMemberSelected-Status and read from that variable later.

What’s New in SAP Analytics Cloud Release 2023.07 | SAP Blogs

Page Input Control “SelectAll” Get/Set and onSelect Script API

We have made enhancements to Input Control APIs to provide story developers with more flexibility to create advanced scenarios.

  • ‘setAllMembersSelected’ – script API to set “All” members in Input Control
  • ‘isAllMembersSelected’ – script API to identity whether member “All” is selected

In addition, story developers can write scripts for an input control’s onSelect event, which are executed when viewers change the member selections

Supported Input Control Types:

  • Dimension Member Input Control
  • Calculation Input Contro
stephlef
Participant
0 Kudos

Hi haidangledo ,

That release looks really promising, thanks for the update! I will see that in one month, when it gets delivered in our Tenant.

Best regards,

Stéphane

stephlef
Participant
0 Kudos

It works! As stated in the comments, you need to be in Optimized Design Mode.

Thanks a lot and best regards,

Stéphane

kavya_kathuria
Explorer
0 Kudos

Hi!

Is there any way to get this introduced to classic (non-optimized) analytical applications as well?

Being able to use this functionality would be great for our team, but since we use blended analysis at places in our dashboards, we can't make the switch to Optimized Design Mode!

Thanks and Regards,

Kavya Kathuria

thayumanavan
Explorer
0 Kudos

Hi @haidangledo,
I am facing the below warning message when I changed the dropdown value "Your data selection has too many values. Auto limit has been applied to your chart to display the values in the order you set. use filters to reduce the number of displayed values".

Can you Please kindly help me to sort out this issue.

scenario is I have two input filter and dropdown

Input Controls are below

1. Customer Region : has the following members ACT,NQ,NSW,NT,QLD,SA,TAS,VIC,WA

2. Business Region : has the following members AUNSW,AUNT,AUQLD,AUSA,AUVIC,AUWA,NZ_LOCAL,#(unassigned)

DropDown

I have written the sac script when user click on JH States it should show Business Region input control and at the same time it create a color dimension. Same scenario if the user click on customer region

Please find the script which I have used it on dropdown - Onclick

if(Dropdown_5.getSelectedKey() === 'JHStates')

{

InputControl_9.setVisible(true);

InputControl_6.setVisible(false);
Chart_18.removeDimension("ZCPFREGN",Feed.Color); ZCPFREGN - Customer Region

Chart_18.addDimension("ZSDH2",Feed.Color); ZSDH2 - JH Sates

}

if(Dropdown_5.getSelectedKey() === 'CustomerRegion' )

{

InputControl_6.setVisible(true);

InputControl_9.setVisible(false);

Chart_18.removeDimension("ZSDH2",Feed.Color);

Chart_18.addDimension("ZCPFREGN",Feed.Color);

}

Once I change the dropdown data is displaying for only 1 year with the below warning

"Your data selection has too many values. Auto limit has been applied to your chart to display the values in the order you set. use filters to reduce the number of displayed values".

Thanks,
Thayu

Answers (5)

Answers (5)

rohitchouhan
Participant

try this

InputControl_1.getInputControlDataSource().setSelectedMembers("");
//reset all

InputControl_1.getInputControlDataSource().setSelectedMembers(["APPLE","BANANA"]);
//select only some filter
stephlef
Participant

Hello Rohit,

Thanks for your answer. The "//reset all" option you propose filters on the single member "", so it unfortunatly doesn't work.

Your 2nd proposal will filter on two elements, where I need All elements.

Cheers,

Stéphane

former_member217691
Participant
0 Kudos

Thanks Rohit

arghasen
Explorer
0 Kudos

One thing you can do,

You can create an array with only interested members, and sort it. This is to keep the values neat and in order.

And then you can just pass this array when you want to reset the filter of the Input Control.

Regards,

Argha

stephlef
Participant
0 Kudos

Hello arghasen,

That's what I did, except that values are not sorted in the array.

Now let's try the new method in optimized design mode next week.

Regards,

Stéphane

Christophe2
Advisor
Advisor
0 Kudos

indeed - tested with updated Analytics app with OVM and it works! Awaiting the blending option for models now 🙂

Christophe2
Advisor
Advisor
0 Kudos

Hello, i'm running iwth version 2023.9 in Fast Track tenant, and still cannot use 'setall' and 'isall' - properties still unused. Am I missing something? Best regards, Christophe

kavya_kathuria
Explorer
0 Kudos

Hi Christophe!

I have noticed the same thing as well! What I realized is that these have been added only to the optimized design experience! So in my analytical applications, I can not see these functions, but once i convert my analytical application to the optimized design story, these methods become available.

Regards,

Kavya Kathuria

JefB
Active Contributor
0 Kudos

Hi christophe.bernard and kavya.kathuria,

There's even a completely new API reference guide:
-> Old API reference Guide for Classic Analytical Apps
-> New API reference Guide for OSE/ODE

N1kh1l
Active Contributor
0 Kudos

christophe.bernard kavya.kathuria

Chris

Kavya is right

The below are only available in Optimized mode and this was mentioned in the feature update blogs already, so the classic application needs conversion to ODE

  • ‘setAllMembersSelected’ – script API to set “All” members in Input Control
  • ‘isAllMembersSelected’ – script API to identity whether member “All” is selected

Nikhil

dohaidang_le
Participant
0 Kudos

Now that is a very backward improvement, because in OVM / ODE, you cannot use getActiveSelectedMembers() and setSeletedMembers() for input control. So what's the point of isAllMembersSelected() and setAllMembersSelected() when the other two APIs are not usable.

Use Optimized View Mode in Analytic Applications | SAP Help Portal

mario_panzenboeck
Contributor
0 Kudos

Hello,

I´m facing the same issue. I used the workaround but instead of "All" my Input control widget is now showing this:

For the widgets the values are correct but it doesn´t look nice for my customer.

Isn´t it possible to select "All" while using the API?

INPUT_CONTROL.getInputControlDataSource().setSelectedMembers("All");
dave_bucher1
Explorer

I tried the following, but it does not work. It selects "All" as the value.

INPUT_CONTROL.getInputControlDataSource().setSelectedMembers("All");