I changed your sheet to display a shape (you can make any shape you want there.)
I made a URL SELECT action to go to Google for the selected state as an example.
SanctCity_UpdatedJW (2)A.twbx 85.8 KB
Where will you be getting your URL from? If you have it in a data field, you can just replace what I have in the URL action with whatever field name you are using. You can see the syntax for using [State] in my example.
You would put that URL field on your sheet, and in the URL string in the EDIT ACTION dialog box, you can use the pull-down to grab your field instead. (Of course, take off Google as well!)
You can probably create the "URL column" with some simple string calcs - if there is a consistent url notation that can be derived by the data you can construct a new string dimension that can be added in and formatted as Text in the crosstab:
i.e. (If i was trying the create a standard url to browse for the item in wikipedia, which typically has a https://en.wikipedia.org/w/index.php?title=<article title>)
Likewise, just format the text blue and edit the font to make it appear to be a hyperlink.
As for actually creating the action that will bring up an article in the browser, using the URL action will still be your best bet. You can reuse the [New URL] calculated field or simply repeat the same structure as the target URL. Happy to show how it can be done if you can elaborate where you want to link out to and how that URL can be derived from the data set.
BTW - Good looking viz!
Thank you for the advice. I will try to follow your advice. When I try to open the workbook you attached, Tableau Public says there's a new version and uploads that instead, which is just the latest version of my project. I can't see any changes that you made.
I will be going to Legiscan for each of the bills. Examples include:
Thank you for your help.
Thank you for your advice. I'm having a two-tiered problem.
(1) I can only make one link for the entire table. So far, I've only succeeded in linking one of the bills, and anytime I click anywhere in the entire table, that one link opens in a new tab.
(2) I'd like to incorporate as many links into the table as there are bills referenced. You can see that most states reference a bill in the right hand column, and some reference many.
I'm new to Tableau, so I appreciate your patience with me. I want to link out to Legiscan web pages, which are all structured as following (this is the link for the Alabama law HB 56 referenced in the first row of the table):
In the Dashboard, I'm going to Actions -> Add Action -> URL -> Run Action On "Select" -> setting Dashboard 1 as my source sheet -> deselecting "Map" so that the link will only apply to "Table" -> inserting link.
Given this interface, I don't know how to drill down and only link to specific text in the table.
Thank you for your help and time,
See the attached workbook - I constructed a series of string calculations to help format the data into the legiscan URL structure you defined.
The major challenge to this boils down to a couple of items:
- The [Laws] field contain multiple values and multiple delimiters that separate the Bill/Act numbers. Whereas humans can interpret this information easily, it becomes a bit harder to reformat the data based on set rules. It might even be easier if each Law/Bill is broken down to an individual row of data in the original data set so that we can break the information in an easier fashion than dealing with a multi-value field. You might be able to restructure the data using the split and pivot functionality in Tableau, or just be modifying the source data
- I noticed that Legiscan does not handle Acts particularly well, so that information for Georgia might not be relevant when it comes to URLs. Again, we simply want to limit exceptions
Given the structure of the data, I focused on constructing a URL that at least fired off the first valid SB or HB in [Laws] by parsing the information and then formatting it into the URL string. I did this in a few steps:
- [Laws (No Spaces,Consistent delimiters)] - Removes all Spaces and then replaces our separators between each ACT/SB/HB (This includes symbols such as "( , /") to "+"
- [Laws (1st Entry)] - I then used the split functionality to split the entries into multiple fields based on separator "+". This represents the first entry from [Laws]
- [Laws (2nd Entry)] - I then used the split functionality to split the entries into multiple fields based on separator "+". This represents the second entry from [Laws]
- [Laws (Valid SB/HB)] - Since I wanted the URL to load the first valid SB/HB rather than ACT, this validates whether the first entry should be skipped in favor of the second entry. This helps with the situation of Georgia where an ACT is listed first
- [Legiscan URL] - Lastly formatting the information parsed from above on valid first SB/HB into the legiscan url string format. This also does a final check that if [Laws]="No laws" then it should not return a URL string at all
The rest is pretty straight forward with the dynamic URL string constructed - place that new calculation in the level of details and then set the URL action against that calculated field. Given what I am seeing, I would encourage reformatting the data so that the [Laws] field does not show multiple values per row, but instead just have multiple rows for each law in the state; Tableau will naturally collapse repeated information down, so this format might be easier if the user want to lookup a specific bill in the list rather than just the first one that is shown (this will also save some of the calculation work as it permits you to jump immediately to the [Legiscan URL] since the parsing is already done in the data). Hope this helps!
SanctCity_UpdatedJW (2).twbx 87.5 KB
Very thorough! Thank you. Will start toying with it immediately. Really appreciate your time.