Change Button Visibility Based on Another Field in Database

I’m designing a character builder to help new players to a tabletop game not have to do as much math.

So, on the first page, I have them enter their character’s name and select their class from a dropdown menu. In the database, I have seven other fields of data designating whether their class gets a certain bonus or not (each field is a true/false). For instance, Barbarian gets Strength and Constitution, while Rogue gets Dexterity and Charisma.

Then, they need to select which bonus they want on the next page. I can think of a few different ways to display it, but I’m not sure how to show which bonuses are available based on the class selection.

Any thoughts?

Hi @MostlyVoid,

Welcome to the forum!

One option is to use many-to-many relationships.

So, you have 3 collections: Characters, Classes and Bonuses.
Character have 1 to many relationship to Classes (i.e. it can belong only to one class). And as I understand each Character can have only one Bonus - it’ll be same relationship type.

Then, each Class can have several Bonuses, and each Bonus can belong to several Classes (this is many-to-many relationship).

So on the 1st screen you create a new Character. Then you need to select a class, you go to the 2nd screen.

On the 2nd screen you display a list of Classes. User selects the class, and you update current Character with a selected class. Then you send user to the next screen.

And on the 3rd screen you display a list of Bonuses, filtered by Current class.
If you’d like to allow a user to select only one bonus, you can have a button “choose” in this list of bonuses. And with this button you can set a relationship of Character to a Bonus.

As a result: Character belongs to one Class and have one Bonus.

Best regards, Victor.

So, I probably have my database set up wrong, if I’m reading this correctly.

I currently have a collection labeled Classes that contains the Class Name (text field) and each bonus type (as a true/false) (7 properties in all)

image

Then, I have each class as a record (Barbarian, Cleric, etc), with it’s bonus type check marked.

I should be expanding that to multiple collections, then?

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.