ERPClimb logoERPClimb
Analytics Designer
SAC / Datasphereintermediate 10 min read

Scripting Widget Interactions and Data Source Filtering in Analytics Designer (Part 4)

Preview · a free account unlocks the full lesson

Key takeaway

Learn how to use Analytics Designer's scripting language to wire up widget events, control filters on data sources, and synchronize multiple charts/tables so an analytic application behaves like a purpose-built app rather than a static story.

In this lessonShow sections

Visual overview

Scripting Widget Interactions and Data Source Filtering in Analytics Designer (Part 4) — learning sheetIn one line: Learn how to use Analytics Designer's scripting language to wire up widget events, control filters on data sources, and synchronize multiple charts/tables so an analytic application behaves like a purpose-built app rather than a static story.ERPClimb.com / SAC / LESSON 4/7 / LEARNING SHEETScripting Widget Interactions and Data Source Filtering inAnalytics Designer (Part 4)1 · IN ONE LINELearn how to use Analytics Designer's scripting language to wire up widget events, controlfilters on data sources, and synchronize multiple charts/tables so an analytic applicationbehaves like a purpose-built app rather than a static story.2 · KEY IDEAS EXPLAINED1Analytics Designer separates itself from standardStories by giving consultants a scripting layer (aJavaScript-like language specific to SAC) thatruns against Application, Page, and Widgetobjects. Once a project moves past simpledrag-and-drop dashboards, script becomes necessary…2The object model matters: an Application containsPages, Pages contain Widgets (charts, tables,dropdowns, buttons, shapes, script variables), andWidgets expose Data Sources when bound to a model(SAC live/import model, which may itself besourced from a Datasphere space via live…3A typical interaction pattern: a Dropdown widget'sonSelect script callsChart_1.getDataSource().setDimensionFilter('Region',Dropdown_1.getSelectedKey()) to filter a chart bythe chosen region. More advanced flows chainfilters across multiple widgets, use Script…4Data source scripting also covers cross-widgetsynchronization: when a Table widget's selectionchanges (onSelect), a script can propagate thatselection as a filter to a separate Chart's datasource, creating a master-detail experience.Because Analytics Designer scripts execute in the…3 · DO · AVOIDBest practice!Common mistakeAlways guard script logic againstundefined/null selections before calling…Set sensible default filters inApplication.onInitialization to avoid…Use Script Variables to centralize sharedstate (like a selected year or region) that…✕Calling setDimensionFilter or setVariableValuewith an undefined/null value when no prior…✕Chaining many sequential filter calls acrosswidgets without considering that each triggers…✕Not testing scripted variable/filter behavioragainst the actual production connection type…4 · IN A REAL PROJECTA retail client wanted a planning review app: users pick a region and year from dropdowns, see a summary chartand a detail table, and can click a table row to drill into a product-level trend chart. The underlying modelwas a live connection to a Datasphere space combining sales actuals and a planning version. The consultant…Original ERPClimb learning sheet • Verify against your SAP release and edition

Explanation

Analytics Designer separates itself from standard Stories by giving consultants a scripting layer (a JavaScript-like language specific to SAC) that runs against Application, Page, and Widget objects.

Once a project moves past simple drag-and-drop dashboards, script becomes necessary to deliver behaviors like: filtering one chart based on selection in another, showing/hiding panels based on user role or dropdown value, resetting filters with a button, or triggering data refresh only after several inputs are set.

This is the core reason Analytics Designer exists as a separate tool from Optimized Story Experience with basic interactivity.

The object model matters: an Application contains Pages, Pages contain Widgets (charts, tables, dropdowns, buttons, shapes, script variables), and Widgets expose Data Sources when bound to a model (SAC live/import model, which may itself be sourced from a Datasphere space via live connection or replication). Each widget type exposes a scripting API surface - for example a Chart widget exposes methods like getDataSource(), setDimensionFilter(), and event handlers like onResultChanged or onSelect. A Dropdown/Input Control exposes onSelect with the selected value, and a Button exposes onClick.

A typical interaction pattern: a Dropdown widget's onSelect script calls Chart_1.getDataSource().setDimensionFilter('Region', Dropdown_1.getSelectedKey()) to filter a chart by the chosen region. More advanced flows chain filters across multiple widgets, use Script Variables to hold intermediate state (e.g., a selected year that several widgets read), and use Application-level scripts (onInitialization) to set default filters/date ranges before the user does anything, avoiding an initial full-context expensive query.

Free account

Create a free account to keep reading

You have read the opening of this lesson. A free ERPClimb account unlocks the rest of it, every other lesson and topic, and your learning history, so you can pick up exactly where you stopped. No card needed.

  • Full explanation
  • Code example
  • Real project scenario
  • Common mistakes
  • Best practices
  • Interview angle

One tap with Google works too. Every topic keeps its first lesson open to everyone.

Keep exploring

Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.