Parameterized "dialog box"

Let’s say that we have items (things) which have not fixed but variable list of attributes. Various attributes are defined in a separate “meta” table. So, we have a couple of data types:

  1. MetaKey are these attributes, the table defines their names
  2. MetaValue has specific values of these attributes
  3. Item are the items

Connections between data types::
MetaKey <-(one-to-many)-> MetaValue <-(many-to-one)-> Item

The question is how to design a typical dialog box which would list all available metakey names (attributes) by rows and with input fields in paralell to allow for the input of attribute values - for a certain item.

Any ideas would be much appreciated.

Okay, if anyone is interested, here’s how to do it:

  1. Firstly, it’s good to create a group for the dialog box, with Type of content Item; this should also control which Item is currently shown
  2. Inside, we create a repeating group with Type of content MetaKey, which shows the whole set of attributes (Search for MetaKey)
  3. Inside a RG’s row we create a text field referencing the name of a MetaKey, which shows the attribute name to the user
  4. Beside it we create an Input field for entering the attribute value, Initial content should stay empty
  5. Under Contitional tab for the input field, we put the contition Search for MetaValue:count>0, where constraints are MetaKey = Current Cell’s MetaKey and Item = Group’s Item
  6. If the above condition is true, we set the Initial content as Search for MetaValues:first item’s Value, where constraints are the same as under 5. (MetaKey = Current Cell’s MetaKey; Item = Group’s Item)
  7. Then we set two workflows of “Input’s value is changed” type, one with the condition Input’s Value is empty, the other with it’s opposite Input’s Value is not empty. These workflows change the details in the database. The first one deletes the thing MetaValue from the database; we search for this thing with the same constraints as before (MetaKey = Current Cell’s MetaKey; Item = Group’s Item).
  8. The other workflow (Input’s Value is not empty) firstly creates a new MetaValue thing (if it doesn’t exist yet; i.e. we set Only when to Search for MetaValues:count<1, constraints again MetaKey = Current Cell’s MetaKey; Item = Group’s Item). We set just the Item and MetaKey from Group’s Item and Current Cell’s MetaKey, respectively. The second action is Make changes to MetaValue, it sets the Value field of MetaValue thing, we search for it with Search for MetaValues:first item, same constraints as always (MetaKey = Current Cell’s MetaKey; Item = Group’s Item). The value comes from the Input field, of course.

The main idea is that we define two key things, that is Item and MetaKey. The first is defined by the whole Group, the second with the courrent row of repeating group, which displays the whole set of attributes, together with their values for a particular Item. Workflows are responsible for the database, and the consistency assumption is that we only have one MetaValue thing (“record”) for an Item <–> MetaKey relation. If a user clears the attribute’s value from the Input field, the record gets deleted, to keep the database as empty as possible.

I’m much satisfied with the way of doing this in Bubble, except for the fact that we are repeating the (MetaKey = Current Cell’s MetaKey; Item = Group’s Item) constraint over and over. I tried to do this in Outsystems (if you know this alternative no-code platform) which seems more robust and comprehensive, but the solution was very nasty --> it is much sleeker in Bubble.

1 Like

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