The Ultimate Transitioning to Bindings 2.0 from Bindings 1.0 Guide.

This post inspired by and a large nod to [Robert Houston][1] whose nickname in our ecosystem is The Wolf. Most likely the best technical person on our platform. The Wolf recently wrote a piece I saw comparing Bindings 1.0 and Bindings 2.0 - this post is a view of this for the community. The idea of this post is to show all steps needed to build a full dashboard in Bindings 2.0 then show a comparison of Bindings 1.0 and Bindings 2.0 in a Copy/Paste scenario for reference. 

Read More

New Flex / Bindings 2.0 - Using Relative Dates in a Static Step and Selection Bindings in SAQL and Compact Graphs

I have had a few requests to redo a number of my posts for new flex and Bindings 2.0 syntax. The below is a redo of the post for a Date Static Step that is used to filter both a SAQL and Compact form graph.

Both are driven by the relative dates that are in the static step. It is important to note that the syntax for the values being passed through to the filters have changed... i.e it is not only the bindings that are new but the values the bindings requires have also changed.

 
 

Below is the Date Static Step that is powering the Date Range button in the above picture. This is a very common pattern in most Analytics Cloud deployments, and this serves as a template. As you can see in the below step we have for each button a SAQL value and a Compact form value.

The below JSON is the code and syntax required to filter the compact form step with the date ranges defined in the above static step. The filter must be added into the query component of the compact from step. Once added the data ranges when selected in the static step will filter the Compact form step.

The below is the SAQL filter that has to be included in a SAQL query when wanting to filter dates in a SAQL query via a static step. Once added, the SAQL query is filtered by the selections in the static step.

Now that we have added a static step into our dashboard , and added the associated filters to both types of widgets / queries, we can see how they look in a completed dashboard. This dashboard is the JSON from the image above.

The JSON describes:

Pillbox Widget connected to the static step Static Step with relative date ranges Compact from bar chart with relative date filtering Pigql query bar chart with relative date filtering

Using a Relative Date Static Step with with a Selection Bind in SAQL Pigql and Compact form Graphs

When building out dashboards for business consumption, there will be in most cases a requirement to have relative date filters and facet across various widgets on the dashboard ( A relative date for example is 3 months from today). A simple way to achieve this maybe to use the Date widget which can be easily added onto the dashboard from the widget toolbar, however another way is to provide a set of buttons that have static date ranges. This can result in a easier dashboard navigation experience, fixed date ranges, and makes it easier for end users to select date ranges that they would like / should only see.

To setup a widget such as the pillbox or the selector widget with relative date ranges you need a static step to drive the dates added as values on the widget. The picture below shows the outcome of a static step controlling two widgets, one widget which is being filtered via the static step in compact form , and the other filtered via pigql.

Below is the static step for the above dashboard. This is the step that is:

  1. Feeding the values of the buttons - everything in the "Values" section is a value,
  2. Detailing what should be displayed on the buttons per value under the "display" tag.

As you can see in each value there are two subordinate values with the parameters of:

  • saqlstepvalue
  • compactstepvalue

In each of the parameters there are the relative date ranges in the syntax required to the specific type of widget / query that will need to render their relative date range filter. The static step filter must be placed in the steps: section on a dashobard.

The below JSON is the code and syntax required to filter a compact form widget where there is no pigql passed to the widget. As you can see in the whole dashboard JSON at the bottom of the page, this filter must be added in the "query" section of a step. The filter is a selection bind in which it takes the value from the selected static step and passes it into the filter for the associated compact form step.

This next script is a pigql query with the outcomes of the query the same as the compact query above. Included in this query as well is a selection bind that takes the relative date selected in the static step and adds it into the query and therefore filters the associated widget.

Now that we have added a static step into our dashboard , and added the associated filters to both types of widgets / queries, we can see how they look in a completed dashboard. This dashboard is the JSON from the image above.

The JSON describes:

  1. Pillbox Widget connected to the static step
  2. Static Step with relative date ranges
  3. Compact from bar chart with relative date filtering
  4. Pigql query bar chart with relative date filtering

Using a Static Step to pass a SAQL / Pigql and Compact Query to a graph via Selection Binding

One of the things you may want to do in Salesforce Analytics cloud.. is to have a Static Step with Buttons attached to control a single graph on a dashboard. These buttons maybe attached to different queries some that can be done via compact form and some that must be done by pigql. This would mean that the static step will need to contain values for both a compact query and pigql query.

This is facilitated by the field binding, where the documentation can be found here

The first thing to start with is to build out the Static Step with both of the query types as seperate values, in my example you can see I have WaitTime and ServiceTime, and for each I have a field for the pigql query and the compact query:

Now that I have my Static Step setup with a piqql and compact field for each value of the Static step, I can now use these as selection bindings to graph these results. For graphs only needing compact form I just need to enter the 'compact' field into the compact query space on the graph, however graphs requiring the pigql query I need to add both the pigql and the compact form selection bindings to ensure that the graph renders.

To show context to the whole dashboard script, below is a full dashboard JSON. In this example there are 3 graphs and 1 selector. Two of the graphs have simple compact queries and dont have any selection binding attached. One of the graphs is controlled by the Pillbox static step and passes both the piql and compact query. We know this works because Pigql queries are always rendered before compact queries.

Below is the image of the final result after selecting the 'WaitTime' option on the Pillbox selector. The top two graphs are normal graphs and are not connected to the Pillbox static step selector however the bottom graph is controlled with the Pillbox static step selector. The top 2 graphs are included in this code, to show what the graphs are expecting in compact form.