In the previous blog in this series, you learned about adding, updating, deleting members in Analytics Designer. In this blog, we will learn how to integrate the Search to Insight feature with Analytics Designer by using various scripting APIs.
SAP Analytics Cloud offers a smart data search feature – Search to Insight. It is an intuitive feature that allows you to gain insights by querying your data using natural language. From version 2020.01, Search to Insight is available for integration into analytic applications.
Imagine you are building an analytic application for business users of all the divisions in your company. Each user’s requirement may vary, and those cases can be challenging. You can add a tab for ad-hoc analysis using the Search to Insight component to facilitate these requirements. This allows them to analyze data with a simple search. You can see the Search to Insight integrated application in action below.
- Index Model – Enable Index Model option under General Settings in model preferences. This allows querying all dimensions and members of the model using the Search to Insight feature. Please note that acquired models have this option enabled by default.
- Create Search to Insight component – Add a Search to Insight component under the Search to Insights section to access the Search to Insight scripting APIs. Add the models required for Search to Insight analysis.
Search to Insight APIs
The APIs used to integrate the Search to Insight feature are:
- SearchToInsight.openDialog() – to launch Search to Insight dialog by passing values for the question, mode, clean history, and auto search parameters. The mode is of two types,
- Simple- for simple queries without changing the model
- Advanced- it allows you to switch models and select dimensions and measures based on your requirements to gain deep insights
- SearchToInsight.applySearchToChart() – to apply insight findings to a chart
Detailed below are the steps in building this smart Search to Insight integrated application:
- Setting up canvas and widgets
As a first step, add the necessary widgets to the canvas. Here the application has input fields, dropdowns, buttons, charts, and text boxes for info.
Bind elements to the Select Mode dropdown as shown below.
Bind elements to the Select Chart dropdown as shown below.
- Launch Search to Insight dialog
In the onClick event of the Search to Insight- Open dialog button, add the below script to trigger the Search to Insight dialog with the mode selected in the dropdown, the question typed in the input field, and the last two Boolean parameters to clean history and auto search, respectively.
- Add chart for Search to Insight findings
In the onClick event of the Add chart for insight button, add the below script to apply Search to Insight finding to the selected chart and toggle that chart’s visibility to ‘true’.
There are also many interesting new updates to the Search to Insight feature. One among them is synonyms for measure and dimensions. From the Q3.2020 version, you can add synonyms for measures and dimensions available in your model to help business users who are not familiar with actual entity names in framing Search to Insight questions accordingly. We will keep you posted about new updates in the Search to Insight feature.