Dr. Nim Rides the Wave!
If you’ve been following along in our Dr.Nim series, you have already seen Dr. Nim play nice with Apex, as well as seeing Dr. Nim getting struck by Lightning. I’m here to show you how Dr. Nim can even ride the Wave - play in Analytics - become Einstein!
For those that don’t know, Dr. Nim always has a habit of winning, no matter what you do! Sometimes it can feel that way building a dashboard for business users too. This post is going to delve into some of the more syntactical complicated aspects of Einstein Analytics with selection bindings and results binding.
Step 1: Show me the data! In order to build any type of dashboard or lens in Analytics, you have to have a dataset. In this example we use a dummy dataset because we are going to dynamically create rows on the fly within the different steps.
Here is the beginning part of the SAQL query that drives the “Coins” in the video. We load our dummy dataset and generate rows with default values and union them all together in the end. You can find a primer on SAQL here.
Step 2: Static Cling!
Static Steps are those steps in an Analytics Dashboard that are not tied to a dataset. In our example, they are the “turn button” groups.
Step 3: Stuck in a bind. With our coin data step and our static selector steps we are ready to have them join forces and have the static selection from the user bind itself to the coin data.
Step 4: We are results driven!
The “Player 2 Picks” number is a calculation based on the sum of Player 1 selections and the amount of remaining coins. Once we filter out the Player 1 selection using the BIND filter from Step 3, we have the remaining coins that Player 2 can select from. Using the handy-dandy formula from the original Dr. Nim, Player 2 can decide how many coins to take:
Once Player 2 “makes” a selection, we update the Coin Graph as follows:
Step 5: Putting it all together...
Since we here at CRM Science LOVE to lose to Dr. Nim play against Dr. Nim, we are a little wise to the tricks. For instance, we know that no matter what, with the combination of 12 coins, and only able to select up to 3 at a time, that there will be only 3 turns per game. It only took hours minutes to figure this out. In the Coin graph dataset, we add the selections from all of the static steps and add the results from Player2 selections and since player 2 is “smart” there will always be 0 coins left after the 3rd round.
Step 6: What's next for Dr. Nim?
There is a model that can be followed for these types of games and when given time, I’ll be exploring building this into even more dynamic and embedded dashbaords to expand the game a bit further and potentially give you a chance to…...Beat Dr. Nim!