Memory Match Using Parameter Actions


Memory Match Using Parameter Actions

Just a few weeks ago, Tableau 2019.2 was released.  This version came with a plethora of new features including vector mapping, collapsible containers, and my favorite feature introduced in the past year, parameter actions.  

Parameter actions open developers up to so many different things that couldn’t be done previously.  I’ve seen the community come up with hundreds of ways to use them ranging from great business use cases to wild and crazy things that may or may not be useful in the future. 

One thing that I’ve always been interested in is the ability to create games within Tableau.  This love is clearly shared with Zen Master, Joshua Milligan, who has created numerous games within Tableau.  In fact, during the beta testing period of 2019.2, Joshua wrote a blog about parameter actions and showed how you could create a Minesweeper game in Tableau!  How amazing is that?  Check out his blog post to see it for yourself.

I personally love playing games…board games, cards, sports, arcade, anything.  When 2019.2 came out, I knew how much easier building games would become.  So, I decided to build a Memory Match game, which was a favorite of my kids when they were younger.  By the way, I haven’t been able to beat my son at the game since he was five.  He has always been soooooo good at it. 

I won’t go into a ton of detail as to how I built this game, but I’ll just give you a quick overview.  Each card is actually two cards stacked on top of each other (a card back and a card face).  When you click on a card, it sends a value to a parameter specific to that pair of cards using a parameter action.  Based on that value, it changes the sorting of the cards to either show the back or the face of that card (yes, this could have been accomplished a number of different ways).  This required a very long case statement to look at each parameter and each option for that parameter. 

As you turn over cards, the number of clicks is tracked via a calculation and another parameter action (this is a cool little trick I learned from Ken Flerlage).  Another calculation looks for values in each parameter and determines if matches are shown.  If a match is shown, it changes the value to tally up the number of matches. 

That's pretty much it at high level (although there are tons of other intricacies).  The result is a Tableau Memory Game showing some of the great Tableau Authors of all time and some other surprises.  And if you want to create your own for your company, family, or whatever, all you really have to do is download mine and replace the card face shapes.  It should work perfectly with little effort. 

Okay, if you are ready, click here to play the game.  I hope you enjoy it!


Kevin Flerlage, June 10, 2019 | Twitter | LinkedIn | Tableau Public










4 comments:

  1. Thank you for your work on this! Any suggestions for randomizing which cards appear and where they appear on the dashboard? I'd like to keep the dashboard as 24 cards like you have it, but I have more than 12 pairs. Thanks!

    ReplyDelete
    Replies
    1. I'll let Kevin respond, but true randomization in Tableau is difficult. You used to be able to use RANDOM(), but a few years back, they changed the way this function seeds random numbers. The result is that it will retrieve the same random number every time. But, there are ways to make this work. Kevin wrote the following blog that might help: https://www.flerlagetwins.com/2022/07/create-random-starting-point-on-tableau.html

      Delete
    2. Ken is right. True randomization is difficult on Tableau Public. The link he shared is the method I've been using for some variety of randomization, but it's not perfect. Sorry that I'm not more help, Sarah.

      Delete
    3. Thank you so much, I really appreciate it!

      Delete

Powered by Blogger.