How to create a thing from a dropdown input?

I have a popup that allows users to create a new Upload. Upload is a data type.

On the popup, one of the inputs is a dropdown “Question” from which users can select from a list of questions. Question is also a data type and Question records are used to populate the dropdown.

The dropdown looks good and works as expected - users can see the list of questions and select one.

But I can’t figure out how to pass the Question data from the pop up’s dropdown field to the newly created Upload records.

I have tried two ways:
(1) I created a Question field on the Upload data type that is a reference to the Question data type.
(2) I created a Question Text field on the Upload data type that is a simple text field.

For approach (1) I can’t find any combination of inputs that works. I’m told “Input Question (Upload)” - the name of the dropdown field - is an incompatible type.

And for approach (2) I’ve got something that seems it should work - “Input Question (Upload)'s value” - but when a new Upload is created the Question Text field is blank.

Seems like this should be easy but I’ve been blocked for a couple of hours. Any advice?

Could be your privacy rules if you’ve set any up? Put your app in debug mode and walk step by step. Click on the Question Text that’s being set to try to understand why it’s getting saved as blank.

Thanks, Zaque, that was helpful.

I need to get into the habit of inspecting / debugging when I run into trouble - still new to Bubble.

Using the debugger I realized the Question Text approach is working. I have two workflows depending upon whether the user uploads audio or video. I forgot to add the Question Text field to the video workflow which I used for testing. Once I added it, everything worked.

Now I’m wondering, is it possible to preserve the relationship between the two data types (i.e. instead of saving the question text, save the reference to the Question record)? I think there could be some advantages to that approach…

1 Like

Glad it was helpful! I’m not entirely following your i.e. example, but generally sounds doable. You may want to also considering these points:

  • How will you reference and retrieve that data later (will your structure make it easier or harder)
  • How efficient will it be to retrieve the information (e.g. difference between performing a Search for data with criteria vs creating a data hierarchy and querying for the parent’s data items)
  • What privacy rules will you need to setup (sometimes these can actually dictate your structure)

Post back if you get stuck.

1 Like

Sorry the example wasn’t clear. Question is a data type. Its records populate the dropdown from which the user selects a question.

When I create an Upload record, I’m able to capture a text snapshot of the question selected by the user using the Question Text field (green highlight below).

I cannot figure out how to save the Question ID of the user selected question (pink highlight below). This would allow me to look up the question text so that if the wording of the question were to change the updated question text would show.

When I try to create this relationships I’m told the input field is an “incompatible type” and I don’t see any other options that would allow me to establish that relationship.

It seems like you’re slightly blurring Things, Fields, and Data Types.

Remember, the Question on the Upload Thing is itself a Thing of type Question. It’s not a field. The input question ID that you’re trying to set it to is a text field I think?

With this datastructure, you’ll probably want to create a Question Thing, add the question ID to a field within that Question Thing, and then add that completed Question Thing to the Upload Thing.

OR, kill your Question data type and replace it with a new QuestionID field that has a type of Text so that it matches your text input with the question id.

What you propose first sounds like what I’m trying to accomplish (the second would be limiting as I envision the Question data type growing in complexity necessitating it’s own Data Type).

Bubble creates IDs automatically when you create a Thing (though the ID is hidden on the App Data tab by default). So each Question Thing does have a Unique ID.

Now I’m just trying to “add that completed Question Thing to the Upload Thing” by having the ID of the selected question appear in each Upload Things’ Question field.

Again, sorry for the confusion. Here’s some sample data to help clarify:

In the image above, I’ve kept the color scheme the same as in my previous post. I can link green of this post with green of the previous post. I want to be able to link pink with pink but cannot.

I’m following now. Is there a particular reason why you’re trying to do this by reference ID? Can you just add the Question to the Upload to achieve the same? Then when you need to retrieve it, you can query Upload’s Question’s Prompt.

By doing so, I believe Bubble is basically adding the Question Unique ID to the Upload for you in the backend.

Alternatively, you can create your own manual unique IDs if you have a true use case for that. I don’t know that it’s possible to access bubble’s ids

Zaque, sorry for the delay and thanks for your patience.

Yes, we are on the same page! This is exactly what I’m trying to accomplish:

Can you just add the Question to the Upload to achieve the same? Then when you need to retrieve it, you can query Upload’s Question’s Prompt.

The problem is I don’t know how to do this.

My Upload data type is set up like this:

My goal is to use to Question field above to establish the Upload <> Question relationship.

Is that the right way to do it? If so, what am I doing wrong in my workflow? Because I can’t figure out how to establish that relationship.

My workflow options for this Question field are shown below. Can you help me find the winning combo?