In this blog I will cover binding in Wave Analytics with a
brief introduction on Wave Analytics.
This is an analytics tool which is developed for Salesforce
and it is a cloud based analytics
which connect data from different sources. It creates interactive views and
shares the views in Apps. It is very useful for the business users who can
check the changing trends in the market and take necessary actions.
Binding feature
enables interaction between the reports in the dashboard as a prompt/filter in
OBIEE. There are two types of bindings in wave analytics namely selection
binding and result binding. By using these we can select different selection
types by which the reports in dashboard changes as per the selection or by
using result binding we can change the result of one step by triggering the
other.
Before moving deep in to this we will discuss about faceting. By here we understood that
the binding is used to create interactions between the widgets or simply the
reports in a dashboard in wave. Faceting is simple and easy way to implement
the interaction between widgets. It is an inbuilt feature in wave analytics.
We have an option in steps where we need to tick the
checkbox, where it says "Apply filters
from faceting". But why we go with the binding is, there is a limitation in
faceting that we can't use this option with the dashboard contains
lens(reports) from different datasets. So we go for binding.
PFB the screen shot
showing the faceting check box for a widget:
There are two types
of Binding, one is Selection and other is the result binding:
1.
Selection
Binding:
The interaction in one step
effects the other step, then it is known as selection binding.
Example:
In the below screen shot the two
bar charts are Sum of Sales by Owner
and Sum of Targets by Owner.
After applying the selection
binding, once we click on any bar in the dashboard the other chart changes as
per the owner selection. Here the
selection binding is on the owner
column.
2.
Result
Binding:
If a step changes based on the
result of another step, then that type of binding is known as result binding.
Example:
The below screen shows the result
binding, here the bar chart changes as per the column in the toggle. By
clicking on the top 5 button in the toggle we are resulting the bar graph to
show top 5 average of amount by Account Industry.
Binding
Functions:
We have three types of binding functions. They are:
v
Data Selection Functions,
v
Data Manipulation Functions, and
v
Data Serialization Functions.
By Using Binding functions, we can get the data from the
step, manipulate it, serialize it and make it used by the target step. These
functions can be used on data like scalars (0, 'This is Einstein analytics' or
null), one and two dimensional arrays.
Binding functions are nested functions and must contain one
data selection function, one serialization function and any number of
manipulation functions.
For Example:
{{column(step_1.selection,[\"Owner\"]).asObject()}}
Here in the selection binding example when we click on any
Owner in the first chart the second chart changes. As we send the Owner column
as an object, when a particular owner is selected the dashboard changes as per
that.
1.
Data Selection
Function:
The source data is selected by selection function. It can either be a
selection or result of a step which returns table of data. In which columns
should have names and rows must contain an index (starts with 0). We can select
columns or rows or a cell for binding.
When one row and one column is selected, it returns one dimensional array
or if it selects multiple rows and columns then it returns two-dimensional
array or if a cell is selected, then it returns a scalar value.
We have three types of selection functions, they are Cell Function, Row Function:
a.
Column Function. Cell Function: Returns a single cell of scalar data, where
row index should be an integer and a column name should be a string and the
cell should exist.
{{cell(step_1.selection,[\"Id\"]).asObject()}}
b.
Row
Function: Returns one row of data as one dimensional array, or
multiple rows which as two dimensional array.
{{row(step_1.selection,[\"Manager\"]).asObject()}}
c.
Column
Function: Returns one column of data as one dimensional array, or
multiple columns which as two dimensional array.
{{column(step_1.selection,[\"Owner\"]).asObject()}}
2.
Data
Manipulation Function:
This function manipulates the data
which is required as per the data serialization function. This function can be
applied on the results of a selection function or even on the result of another
manipulation function. The input can be null, if so, it will return a null value.
If there is no requirement for the
data manipulation function, we can directly add a serialization function to the
results of data selection function.
The data manipulation functions
are as follows:
1. Coalesce function: It is used to
provide a default value when null value is returned.
2. Concat Function: Concates data from multiple
sources and returns as a one or two dimensional array.
3. Flatten Function: It flattens a 2
dimensional array to a single dimensional array.
4. Join Function: Converts one or two
dimensional array into a string.
5. Slice Function: From one dimensional
array gives first and optionally the end position and returns the one
dimensional array. It supports negative indices.
6. toArray Funtion: This function
basically converts the data to array, for example if the data is in scalar form
it changes to one dimensional array or if it is in one dimensional array then
it changes to a two dimensional array.
7. valueAt Function: As the name suggests,
it gives the value of a particular index which is requested for.
3.
Data
Serialization Functions: This function converts the data as per
the binding requirement.
The below are the different types
of serialization functions:
1. asDateRange():
this function returns date range filter..
2. asEquality():
this function returns 'equals to' or 'contains in' filter.
3. asGrouping():
this function is used to return a single or multiple groups.
4. asObject():
this function returns data as object.
5. asOrder():
this function returns sorting order.
6. asProjection():
this function is used to project a field in step.
7. asRange():
This function returns a range filter.
8. asString(): this function returns a string.