URL actions

URL actions are useful when you wish to connect users to external and auxiliary data, whether it's from a public interest website or to a related dashboard. In the next example, you will create a URL action that allows users to view the World Bank's website for each country.

The URL action that you will build will append the name of each country as a variable to the root URL for the World Bank's well-organized websites.

The root URL is http://www.worldbank.org/en/country, and in order to get to a specific country, such as South Africa, you need to add the country name so that it looks like http://www.worldbank.org/en/country/southafrica.

There is one issue—there are no spaces in the country names in the URL and yet, there are spaces in the country names in the data source.

So first, create a Calculated field that removes the space in each Country name so that we can append it as a token to the URL.

To remove and append the Country name with a URL, perform the following steps:

  1. Go to the Map worksheet and create a Calculated field in the Data source.
  2. Name the Calculated field CountryName.
  3. In the Calculated field, write a formula that uses the Replace function to remove the spaces in the Country field, as shown in the following screenshot. You need to remove the spaces because in the URL, for each country, there are no spaces. Different websites treat spaces differently, depending on their information management strategy and encoding; others might replace spaces with %20:
    URL actions
  4. Add this field to the Detail shelf on the sheet.
  5. Note that the percentile table calculation that generates the color for each country no longer seems to work because it was addressing only by Country Name before and it wasn't partitioned (or grouped) by any other values.
  6. In order to solve this problem, click on the context menu for the field on the Color shelf.
  7. Click on Edit Table Calculation.
  8. In the Running Along drop-down list, select Advanced.
  9. Click on the CountryName field in the Partitioning pane and then click on the right arrow to move it over to the Addressing pane, as shown in the following screenshot:
    URL actions
  10. Click on OK.
  11. Go back to the dashboard. From the Dashboard menu, select Actions.
  12. Create a new URL action.
  13. Name the URL action with the text that will prompt users to perform a specific action, such as Click on Here for Country Data. You want the result to be very obvious because this action will be a Menu action, which means that the name of the action will appear as a call to an action at the bottom of the tooltip, as shown in the following screenshot:
    URL actions
  14. Select CO2 Emissions per Capita as the source sheet.
  15. Run the action on Menu.
  16. Paste the root URL for the World Bank into the URL box. Then, click on the arrow to the right of the URL box to see a list of fields that you can insert as a variable token.
  17. Select CountryName from the list.
  18. Test the link by clicking on the Test Link button and, if it works, click on OK.
  19. Click on OK again.
  20. Click on a Country (China, for instance) and check out the call to action at the bottom of the tooltip, which you unfortunately cannot format differently, that guides the user to click on Click Here For Country Data to see country data in detail, as shown in the following screenshot:
    URL actions
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset