The power of static steps

28. February 2017 Einstein Analytics, How To 5

Sometimes you want to give your end users a little bit more flexibility when viewing Wave dashboards. This could be by allowing them to choose which grouping or measure to use in the graph. Static steps are a way for you to empower this flexibility.

First, we need to create a lens we can put on our dashboard and modify with static steps. In my example I have used the measure “Sum of Amount” and the grouping “Industry”. I’ve also sorted my column graph descending. When you got your lens ready clip it into your dashboard.

StaticStepsLens

The next thing is to add the static steps in the flex designer. You can also choose to write and add the code directly in the dashboard JSON. I’ve created one for grouping, measure, limit, order and filter, which should look like this:

Now we need to add the static steps to the dashboard, I’ve chosen the toggle widget for all my static steps.

The rest of the changes will have to be done in the dashboard JSON, so preview the dashboard and enter command + e (for mac users) or control + e for (for PC users). Let’s first find the static steps for measure, group, limit, order and filter. It’s nice that the flex designer can help us create some of the logic, unfortunately I’ve found that it adds some additional characters so make sure your steps look like this:

Static measure

"StaticMeasure_1": {
 "datasets": [],
 "dimensions": [],
 "groups": [],
 "isFacet": false,
 "isGlobal": false,
 "label": "StaticMeasure",
 "numbers": [],
 "selectMode": "singlerequired",
 "strings": [],
 "type": "staticflex",
 "useGlobal": false,
 "values": [
 {
 "display": "Sum of Amount",
 "value": [
 "sum",
 "Amount"
 ]
 },
 {
 "display": "Avg of Amount",
 "value": [
 "avg",
 "Amount"
 ]
 }
 ]
 },

Static group

 "StaticGrouping_1": {
 "datasets": [],
 "dimensions": [],
 "groups": [],
 "isFacet": false,
 "isGlobal": false,
 "label": "StaticGrouping",
 "numbers": [],
 "selectMode": "singlerequired",
 "strings": [],
 "type": "staticflex",
 "useGlobal": false,
 "values": [
 {
 "display": "Opportunity Type",
 "value": "Type"
 },
 {
 "display": "Industry",
 "value": "AccountId.Industry"
 }
 ]
 },

Static limit

"StaticLimit_1": {
 "datasets": [],
 "dimensions": [],
 "groups": [],
 "isFacet": false,
 "isGlobal": false,
 "label": "StaticLimit",
 "numbers": [],
 "selectMode": "single",
 "strings": [],
 "type": "staticflex",
 "useGlobal": false,
 "values": [
 {
 "display": "3",
 "value": 3
 },
 {
 "display": "5",
 "value": 5
 },
 {
 "display": "7",
 "value": 7
 }
 ]
 },

Static order

"StaticOrder_1": {
 "datasets": [],
 "dimensions": [],
 "groups": [],
 "isFacet": false,
 "isGlobal": false,
 "label": "StaticOrder",
 "numbers": [],
 "selectMode": "single",
 "strings": [],
 "type": "staticflex",
 "useGlobal": false,
 "values": [
 {
 "display": "Ascending",
 "value": [
 -1,
 {
 "ascending": true
 }
 ]
 },
 {
 "display": "Descending",
 "value": [
 -1,
 {
 "ascending": false
 }
 ]
 }
 ]
 },

Static filter

"StaticFilter_1": {
 "datasets": [],
 "dimensions": [],
 "groups": [],
 "isFacet": true,
 "isGlobal": false,
 "label": "StaticFilter",
 "numbers": [],
 "selectMode": "single",
 "strings": [],
 "type": "staticflex",
 "useGlobal": false,
 "values": [
 {
 "display": "UK",
"value": [
 "AccountId.BillingCountry",
 [
 "United Kingdom"
 ],
 "in"
 ]
 },
 {
 "display": "Won Oppty",
"value": [
 "IsWon",
 [
 "true"
 ],
 "in"
 ]
 }
 ]
 },

To make sure that your column graph facets with your new static steps, we need to make sure they are bind together using selection binding. Find your step and in its query section make the following changes, remember to make sure the highlighted text matches the static steps you have created:

"query": {
 "measures": "{{column(StaticMeasure_1.selection, [\"value\"]).asObject()}}",
 "limit": "{{column(StaticLimit_1.selection, [\"value\"]).asObject()}}",
 "groups": "{{column(StaticGrouping_1.selection, [\"value\"]).asObject()}}",
 "filters": "{{column(StaticFilter_1.selection, [\"value\"]).asObject()}}",
 "order": "{{column(StaticOrder_1.selection, [\"value\"]).asObject()}}"
 },

This should make the whole step look like this:

"StepSales_1": {
 "datasets": [
 {
 "id": "0Fb58000000CeCnCAK",
 "label": "Opportunity with Account and Campaign",
 "name": "Opportunity_with_Account_and_Campaign",
 "url": "/services/data/v39.0/wave/datasets/0Fb58000000CeCnCAK"
 }
 ],
 "isFacet": true,
 "isGlobal": false,
 "label": "StepSales",
 "query": {
 "measures": "{{column(StaticMeasure_1.selection, [\"value\"]).asObject()}}",
 "limit": "{{column(StaticLimit_1.selection, [\"value\"]).asObject()}}",
 "groups": "{{column(StaticGrouping_1.selection, [\"value\"]).asObject()}}",
 "filters": "{{column(StaticFilter_1.selection, [\"value\"]).asObject()}}",
 "order": "{{column(StaticOrder_1.selection, [\"value\"]).asObject()}}"
 },
 "selectMode": "single",
 "type": "aggregateflex",
 "useGlobal": true,
 "visualizationParameters": {
 "visualizationType": "vbar",
 "options": {}
 }
 }

Now preview and save your dashboard. That’s all you need to do in order to use static steps to make your dashboards even more flexible.

**Update – in the Spring 18 release Salesforce introduced a new parameter ‘columnMap’, which means the bindings described in this blog will throw an error unless the ‘columnMap’ is adjusted as described in this blog**


5 thoughts on “The power of static steps”

  • 1
    Valentin on May 22, 2017 Reply

    Hi,

    Thanks for this really great post ! do you know if there’s a way to use a static step to manage some true/false parameters ?
    I’m trying to use a static step to define if a chart should be normalize “true” or “false” but for the moment the code bellow doesn’t work :

    “chart_1”: {
    “parameters”: {
    “autoFitMode”: “keepLabels”,
    “showValues”: true,
    “legend”: {
    “showHeader”: false,
    “show”: true,
    “customSize”: “auto”,
    “position”: “right-top”,
    “inside”: false

    },
    “normalize”: “{{column(Normalize_ou_value_1.selection, [\”value\”]).asObject()}}”,

    “satic_step”: {
    “Normalize_ou_value_1”: {
    “type”: “staticflex”,
    “values”: [
    {
    “display”: “Normalisé”,
    “value”: true
    },
    {
    “display”: “Valeur”,
    “value”: false
    }
    ],

    • 2
      Rikke on June 5, 2017 Reply

      Hi,

      Looking at the code the normalize should be inside the {}, also it seems that some of the parameters are missing from the chart. Now the statement should be something like this: “normalize”: “{{cell(Normalize_ou_value_1.selection, 0, \”value\”).asString()}}”. However, I’ve found that even though the documentation says you can bind widgets to static steps, it is only maps that currently accepts a string value.

      Cheers

  • 3
    Surbhi on April 12, 2018 Reply

    Hi,

    A big thanks for this post. it solved so many doubts i had.
    i am trying to put value with certain condition in my static step and group the chart with this static step.
    but i am getting this error :This widget can’t be displayed because there is a problem with its source step:a.replace is not a function.
    except this two display-value pair others are working fine.PFB static step code
    “staticstep_1”: {
    “broadcastFacet”: true,
    “groups”: [],
    “label”: “staticstep”,
    “numbers”: [],
    “selectMode”: “singlerequired”,
    “start”: {
    “display”: [
    “Order Finalized Year”
    ]
    },
    “strings”: [],
    “type”: “staticflex”,
    “values”: [
    {
    “display”: “Without Forms”,
    “value”: [
    “Number_of_Forms__c”,
    [
    [
    0
    ]
    ],
    “==”
    ]
    },
    {
    “display”: “Status assigned”,
    “value”: [
    “Status__c”,
    [
    “Assigned”
    ],
    “in”
    ]
    }]
    and Grouping :
    “groups”: [
    “{{column(staticstep_1.selection,[\”value\”]).asObject()}}”
    ],

    • 4
      Rikke on April 12, 2018 Reply

      It looks to me like you are passing filters as a grouping, that won’t work. You have to split it out in two if it is meant to be a grouping. Your group and your filter condition separately. You can have two values in your step, just call them value1 and value2 and remember to call the correct one in the binding.

Leave a Reply

Your email address will not be published. Required fields are marked *