Trying to display random bits of info from data tables

Here is the idea I’m working on. I’m a game master for tabletop rpg games. I wanted to build an app that I can input tables of info into and then have the app pull random bits of info from those tables based on questions answered in drop down menus.

So for example, during my game I might tell the app that we are in a certain district and I’d like it to pull a random encounter from a table of possibilities that I’ve already created.

Is there a video or some sort of reference anywhere from what I’m trying to do? At the moment I’m using the free option of bubble to see if it will be able to do what I’m thinking of, if it matters for what I am trying to do.

Welcome to Bubble, Nicole.

Here’s a quick sketch of what you might do:
Create a DistrictEncounter table with a record for each possible encounter for each district.
When looking for a random encounter in a district:

  • generate a random integer from 1 to the number of possible encounters in the district.
  • search for all district records and select the nth one (where n is the random integer.)

The exact syntax for the random number generation and search are not readily at hand, but I think you get the idea. (These are two techniques I haven’t put to practical use yet.)

Depending on your experience with Bubble, you might do well to sign up for some courses or other resources from third-party providers. and are a couple of possibilities.

Best of luck.

Hi Laurence,

I’m seeing an option in workflow for Element Actions to “Display data” in a Group. I have the Group set up for text and I’m trying to pull a random option from a test list that I have set up, but nothing is displaying.

Would these screenshots help anyone figure out what I am doing wrong?

Here is the Group that I set up.

The is the first part of the workflow where I’m asking for it to display a random option from a test list I created.

And this is where I ask it to show the Group box, because I have it toggled to not be visible upon page load.

When I preview though and select the option from the dropdown that should make the Group box visible, I don’t see anything.

In my experience with Bubble, I went down a path that may have bypassed some fundamentals that would help you, but I see a couple of things I recall encountering. What follows is going to be confusing, possibly bewildering and frustrating. It’s the nature of learning Bubble, depending on your prior experience with programming languages and web development.

A group element doesn’t actually show a text value. It is a container for other elements. In this case it looks like you’ll want to add a Text element to show the random text you’ve selected. Confused? Keep reading. It may get worse before it gets better.

Note: the name of the group, “Group text”, is misleading. Bubble generated that name because it is a Group element and you’ve said its type is text. If you click into the header of that specification window where it says “Group text”, you’ll see that you can change the name. If I were to use a Group element to contain some text where the purpose of the text is to show an encounter, I’d name it something like “groupEncounter”. This signifies that the element is a group and it shows an encounter.

Next, the Display data action in a workflow is a horrible name choice by the Bubble creators. It doesn’t describe what’s actually happening. What Display data does is put something into the group element, not display or show anything. It’s up to other elements in the group to make that something visible.

As it’s set up now, the group may or may not contain some text, but it won’t do anything to make it visible.
In the group specification:
I don’t understand the Data source because I don’t know what All Weather Table Test is. But it must be a text value, otherwise Bubble would have thrown an exception. Bubble requires Data source to agree in type with Type of content.

Okay, so if it’s correct that the Data source is a piece of text, it’s just sitting there in the background inside Group text.

Inside the group you’ll want to place a Text element, let’s call it txtEncounter. Its spec can be as simple as this:
When run, it will contain (and show) the text value that is contained in the group Group text (or hopefully you’ve renamed it to something like groupEncounter.)

I realize you’re just experimenting at this point, but rather than a Group on the page you might want to try a Popup.

Does that mean you don’t see the group at all? I don’t recall, but if you’re using default formatting, the group may be the same color as the page background so it won’t be visible. It might be best to add an outline to the group or change its background color so you’ll know it’s been displayed.

Bubble may be “no code”, but it is programming in a unique, odd way. It will not be a quick and simple process to learn it well enough to build something useful, but it can be rewarding if you stick with it.

Good luck.

This topic was automatically closed after 70 days. New replies are no longer allowed.