<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: SAC Linked Analysis | RemoveDimensionFilter API in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/sac-linked-analysis-removedimensionfilter-api/qaa-p/13641726#M4822252</link>
    <description>Dear, you are right the method is available. It can be executed as well, but it doesnt return the desired output as the filter does not get removed. Could you further elaborate how you would utilize these APIs to rebuild the linked analysis? Thanks!</description>
    <pubDate>Mon, 18 Mar 2024 14:47:00 GMT</pubDate>
    <dc:creator>SAC_Newbie</dc:creator>
    <dc:date>2024-03-18T14:47:00Z</dc:date>
    <item>
      <title>SAC Linked Analysis | RemoveDimensionFilter API</title>
      <link>https://community.sap.com/t5/technology-q-a/sac-linked-analysis-removedimensionfilter-api/qaq-p/13635157</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;I am currently struggling with a problem I am not able to solve. I am creating a application (unified story) which has several linked widgets including one table. This table is used as a basis for my scripting.&lt;/P&gt;&lt;P&gt;On Initilization of the script a dropdown with the dimension SAC_Product is populated and this dropdown filters the table:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Table_2.getDataSource().setDimensionFilter("SAC_PRODUCT", Dropdown_1.getSelectedKey());
console.log(Dropdown_1.getSelectedKey());&lt;/LI-CODE&gt;&lt;P&gt;This works fine. In the next step I would like to delete all filters from the product dimension. Currently I am trying to do it with a button for simulation (but it should be done via selecting "All" in the dropdown). So on the click of the button I execute this script:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Dropdown_1.removeAllItems();

Table_2.getDataSource().removeDimensionFilter("SAC_PRODUCT");&lt;/LI-CODE&gt;&lt;P&gt;The dropdown items get deleted but the filter for the table doesnt change. Once I remove the linked analysis from all widgets which are connected to Table_2 this code does work. So it appears with linked analysis the removedimensionfilter() doesnt work. Is this something you have also experienced. Could this be a bug?&lt;/P&gt;&lt;P&gt;As a workaround I have tried the following:&lt;/P&gt;&lt;P&gt;Looping through the dimension and binding all items to an array. Then using this array and .setDimensionFilter() to filter on all items.&lt;/P&gt;&lt;P&gt;This does work for my example with very few dimension members. But I believe that with increasing number of dimension members (large models) the loop itself will cause a lot of time.&lt;/P&gt;&lt;P&gt;Can you help me with that?&lt;/P&gt;&lt;P&gt;Best&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2024 08:58:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sac-linked-analysis-removedimensionfilter-api/qaq-p/13635157</guid>
      <dc:creator>SAC_Newbie</dc:creator>
      <dc:date>2024-03-12T08:58:58Z</dc:date>
    </item>
    <item>
      <title>Re: SAC Linked Analysis | RemoveDimensionFilter API</title>
      <link>https://community.sap.com/t5/technology-q-a/sac-linked-analysis-removedimensionfilter-api/qaa-p/13635878#M4821604</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;linked analysis &amp;amp; unified story still have some limitations&lt;BR /&gt;please vote here:&amp;nbsp;&lt;A title="getDimensionFilters() for global linked-analysis-filters" href="https://influence.sap.com/sap/ino/#/idea/309690" target="_blank" rel="noopener"&gt;getDimensionFilters() for global linked-analysis-filters&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;if .getDimensionFilters work than .remove... should also be available.&lt;BR /&gt;Atm. I prefer not using the built-in linked analysis and use the APIs listed&amp;nbsp;&lt;A title="here" href="https://help.sap.com/docs/SAP_ANALYTICS_CLOUD/00f68c2e08b941f081002fd3691d86a7/5bb384ea6b6342129bfa3823a2d859a7.html?locale=en-US" target="_blank" rel="noopener"&gt;here&lt;/A&gt;&amp;nbsp;instead.&lt;BR /&gt;br&lt;BR /&gt;edgar&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2024 16:15:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sac-linked-analysis-removedimensionfilter-api/qaa-p/13635878#M4821604</guid>
      <dc:creator>eeddggaarr</dc:creator>
      <dc:date>2024-03-12T16:15:48Z</dc:date>
    </item>
    <item>
      <title>Re: SAC Linked Analysis | RemoveDimensionFilter API</title>
      <link>https://community.sap.com/t5/technology-q-a/sac-linked-analysis-removedimensionfilter-api/qaa-p/13641726#M4822252</link>
      <description>Dear, you are right the method is available. It can be executed as well, but it doesnt return the desired output as the filter does not get removed. Could you further elaborate how you would utilize these APIs to rebuild the linked analysis? Thanks!</description>
      <pubDate>Mon, 18 Mar 2024 14:47:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sac-linked-analysis-removedimensionfilter-api/qaa-p/13641726#M4822252</guid>
      <dc:creator>SAC_Newbie</dc:creator>
      <dc:date>2024-03-18T14:47:00Z</dc:date>
    </item>
    <item>
      <title>Re: SAC Linked Analysis | RemoveDimensionFilter API</title>
      <link>https://community.sap.com/t5/technology-q-a/sac-linked-analysis-removedimensionfilter-api/qaa-p/13641733#M4822258</link>
      <description>Hi, I will describe my workaround as a new answer because comments are very limited in terms of format/layout...</description>
      <pubDate>Mon, 18 Mar 2024 14:56:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sac-linked-analysis-removedimensionfilter-api/qaa-p/13641733#M4822258</guid>
      <dc:creator>eeddggaarr</dc:creator>
      <dc:date>2024-03-18T14:56:22Z</dc:date>
    </item>
    <item>
      <title>Re: SAC Linked Analysis | RemoveDimensionFilter API</title>
      <link>https://community.sap.com/t5/technology-q-a/sac-linked-analysis-removedimensionfilter-api/qaa-p/13641819#M4822266</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;here my workaround.&lt;BR /&gt;I have a live BW story with multiple charts&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;filtering in one chart should have an effect on all other charts/tables ( = linked analysis)&lt;/LI&gt;&lt;LI&gt;as users want to jump to another story or to an ERP transaction with the same filters they set in the story I need to be able to read the current filter situation to create the URL.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I have decided not to use built-in linked analysis because at this point in time .getDimensionFilters returns an empty array if used in combination with linked analysis.&amp;nbsp;&lt;BR /&gt;Therefore I wanted to use a users selection within one or multiple charts as basis for filtering.&lt;BR /&gt;As users want to change the charts dimensions I initially used standard dimension input controls. However, there is no working API which will return current selected dimension/s directly from the input control.&lt;BR /&gt;If the number of used dimensions is very small you could use the workaround from&amp;nbsp;&lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/719694"&gt;@tablespace&lt;/a&gt;&amp;nbsp;described&amp;nbsp;&lt;A title="here." href="https://community.sap.com/t5/technology-q-a/sac-script-api-can-i-work-with-story-filter-by-using-scripting/qaq-p/12810038" target="_blank" rel="noopener"&gt;here&lt;/A&gt;&amp;nbsp;(he uses input controls to get active selected members). But that was not suitable for my use case as more than 25 dimensions are being used and performance degraded very fast.&lt;BR /&gt;That is why I am now using dropdowns instead of dimension input controls because Dropdown_XY..getSelectedKey() &lt;STRONG&gt;always&lt;/STRONG&gt; works without problems (to get the current dimension from a chart directly with&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;console.log(Chart_1.getDimensions(Feed.CategoryAxis));&lt;/LI-CODE&gt;&lt;P&gt;gives back an empty array).&lt;BR /&gt;To get a users selection and use that for filtering was a little bit tricky. If you use a charts built-in onSelect method to e.g. console.log() the current selection than you will always get the users selection. But I wanted the user to be able to select one or more dim members in a chart and filtering should only start if he pushes a specific filter button which appears if&amp;nbsp; selection length &amp;gt; 0.&amp;nbsp;&lt;BR /&gt;Unfortunately, this does only work if user selects more than 1 member. If only one member is selected and the filter button is pushed the selection is lost. If 2 or more members have been selected and the filter button is pushed =&amp;gt; selection is available.&lt;BR /&gt;I am now using a global variable for each chart and whenever selection length is &amp;gt; 0 this variable is populated. Function called with charts onSelect method:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var sel = Chart.getSelections();
if (sel.length &amp;gt; 0) {
	if (Chart === Ch_1) {
		v_Ch_1_sel = sel;
	}
	if (Chart === Ch_2) {
		v_Ch_2_sel = sel;
	}
...
...&lt;/LI-CODE&gt;&lt;P&gt;the filter button uses coding below to push the filter to a story filter object:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var FS = Application.getFileDataSource("yourModelID");
//example for chart 1 for simplification
var currentDimID = Dd_Ch_1.getSelectedKey();
var currentDimDescr = Dd_Ch_1.getSelectedText();

// onSelect will be triggered after filter is being set, therfore
// use condition sel.length &amp;gt; 0 to stopt that
if (v_Ch_1_sel.length &amp;gt; 0) {    
    var filterValues = ArrayUtils.create(Type.string);
    for (var i = 0; i &amp;lt; v_Ch_1_sel.length; i++) {
        var filterValue = v_Ch_1_sel[i][currentDimID];
        if (filterValues.includes(filterValue)) {} else {
            filterValues.push(filterValue);
        }
    }
    FS.setDimensionFilterWithHierarchy({id: currentDimID, description: currentDimDescr}, Alias.FlatHierarchy, filterValues);
	v_Ch_1_sel.splice(0, v_Ch_1_sel.length);
}&lt;/LI-CODE&gt;&lt;P&gt;with that I have all other objects in the story with the same filter situation and I can use&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;FS.removeDimensionFilter("dimensionXYZ");&lt;/LI-CODE&gt;&lt;P&gt;to get rid of one or all dim filters.&lt;BR /&gt;br&lt;BR /&gt;edgar&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Mar 2024 16:04:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sac-linked-analysis-removedimensionfilter-api/qaa-p/13641819#M4822266</guid>
      <dc:creator>eeddggaarr</dc:creator>
      <dc:date>2024-03-18T16:04:28Z</dc:date>
    </item>
  </channel>
</rss>

