Dynamic hierarchy into streamsheets?

I’m not even sure this is possible, but I thought I’d ask before I pull any more hair out.

I’ve created a game that uses an mqtt database as a server and after a game it would be snazzy to be able to process the various data into a summary email showing which team was fastest at each challenge/etc.

The structure of the game is all hung under a dynamically created gameID and each player is populating assorted topics. For example:

In this case the gameID is “DC-Z” and under that is a topic hierachy of players with “name, status, time, x and y” topics underneath.

From what I can figure out with streamsheets, It would be super easy to work with team 1/2/3… if there was only one game. But since the entire heirarchy is hanging under a topic that will have the day’s date as well as a personal code to the players, is there any way at all to process that? Like, ideally every game would be a new streamsheet?.. (or it would process the game, export some outcome to an email/csv, then move on to next game?)

Any thoughts/ideas about how this might be done are appreciated.

Hi cbandy,

Multiple Apps:
That sounds like a really cool application.
In theory, we offer a feature to create Apps via HTTP requests and configure them. This is an enterprise feature, so it is probably of no use for you.
There you could go ahead and set the Consumer topics, so one app would cover one game.

One App:
But in general the application would be the same, if one app would handle everything. Dividing it in multiple apps would reduce the load an app would have to handle. I’m not sure how much traffic you will expect, but at least for a PoC, one app should be enough.

If I understand this right, you basically have dynamic topics depending on the game ID.

What you could do is use the outbox feature. In the outbox, you can create multiple messages over time and send these as you please. Set your consumer topic to “#” to get all messages and use the metadata to read, from which topic a message has been sent. Implement a logic which bases the naming of the outbox messages on the topics.
image
open the outbox here

image
metadata from a message

Use the WRITE() function to add items to the Outbox message. Over the course of the game, you could add information to the message and send it out as soon as the game is done.

=WRITE(OUTBOXDATA("messagename"),JSON(A1:B2),)

Use DELETE() to get rid of the message after sending the mail.

=DELETE(OUTBOX("messagename"))

So basically update information in the outbox depending on the topic name.
Some examples of useful functions to dynamically analyze your topic name:

I hope that helps :slight_smile:

Let me know how to play your game, so I can get my stats send to me too :stuck_out_tongue:

Best

Tizian

Thanks for the help, Tizian! I’ll follow up if i’m able to get it to work! Cheers!

1 Like