The following describes a case study that demonstrates how scriptable dashboards work.
Scenario
A survey was run which captured data from 5 different countries, and this dataset was uploaded to Crunch. But the deliverable to the client is 6 different datasets, each with their own dashboard - one for each individual country and a further dataset that has data for all countries. The goal, then, is to use Crunch to not only create these individual country datasets but to give each their own dashboard. Whilst this example will talk about countries, the same principle would apply to different regions, sectors, departments etc. as needed.
Method
Step 1
Create a Dataset View for each country. At the “Rows” stage of the creation wizard, select just the respondents who are from the relevant country.
Place the Dataset View in a location that you can access but is not yet available to your stakeholders. Add some country indicator to the name of each for ease of identifying which is which.
Step 2
In the dataset that has data for all countries, use the existing GUI techniques to create a dashboard that has the tiles and analyses you want your users to see. This is now your template dashboard.
Step 3
Download the script from your template dashboard. The Download script option is available both from the dashboard’s main menu and from the deck/dashboard tray’s menu. Save the file to somewhere on your computer.
Step 4
Navigate to one of the Dataset Views, open the slide-in deck/dashboard tray and choose “New dashboard” from the tray’s menu, followed by “New from script…”.
In the Crunch Automation panel that appears, choose “Upload file” and select the file you downloaded in step 3.
Step 5
Run the script. You now have a duplicate of the dashboard in this Dataset View.
Step 6
Repeat steps 4 and 5 for each of the Dataset Views.
Step 7 (optional)
You are likely to want to add an additional Groups panel filter for the Country variable to the all-countries dataset to enable users to view results for each individual country.
Editing the script
The method described above assumes that there are no differences between the questions asked in each country, but this is commonly not the case. Certain questions might apply to some territories and not others, and often answer categories (e.g. brand lists) will vary too. That might mean that, at step 1, you created Views that had a similar set of variables but not actually the same. In those instances, the dashboard you create as a template in step 2 above might not give you exactly what you want in the Dataset Views. There are two ways in which this might manifest:
- The dashboard passes the validation test (which happens when you run the script) but contains some tiles that need modification or removal. For example, you might have questions with brand lists that aren’t right for the country, or tiles with no data because those questions weren’t asked in that country.
- These can be deleted in the GUI using Edit mode, just like a manually-created dashboard. Similarly, any additional content appropriate for this country can be added by saving additional analyses from Tables & Graphs mode or creating additional Rich-text tiles from within the dashboard’s Edit mode. Alternatively, if you discover that something needs changing about lots or even all tiles (e.g. a different filter or weight applied), you’ll find it quicker to apply that change to each tile in the script and re-upload the dashboard script. Individual
- The dashboard fails the validation test and returns one or more errors which need to be fixed before the script can be run. There’s a whole separate documentation devoted to the script itself and how to edit it, but typical validation errors for this use-case will be caused by variables or filters that don’t exist in the View but are referenced in the script (note that the script, and therefore the validation message, uses variable aliases rather than titles). The solution for variables that don’t exist is to open the script in a text editor (e.g. Notepad++) and do a search for the variable alias that’s triggering the validation error. You can then decide whether there’s a different variable that should be used that’s correct for this country (e.g. swapping `awareness_GB` for `awareness_US`) or whether that whole “TILE” section should be deleted. You may well have multiple references to fix before the script will successfully validate. Validation errors about filters not existing are usually because one or more filters that were used in the original dashboard are not present in the View. Remember that user artifacts such as filters do not automatically copy across to Dataset Views and therefore filters referenced in the original dashboard need to be recreated, with their same names, in the View. Making these adjustments can be done at any of these levels - whole dashboard script editing, single tab script editing, or single tile script editing, available here…