Using inputs to create a conditional to show image

Hello all and Happy Friday to you! :sunglasses:

I have 3 different multiple choice input fields, that create a single application data for the user.

I am trying to get the conditional of an image element to show a specific image based on the user selections.

TY in advance. TO


Hi there, @Coastal_Dude… it’s me again. :slight_smile:

If I remember correctly, you were trying to pass a newly-created thing to another page and then display a certain image based on the values in that thing’s fields, right? If that is correct, you shouldn’t need to do a search in the conditional. It should be something more like when this thing’s (or this page’s thing’s or this parent group’s thing’s) Oil Type Field contains Light Oil and this thing’s Oil Location Field contains Surface and this thing’s Shoreline Type Field contains Bedrock, then display a particular image. Are you able to specify exactly which thing in the Selection data type you are referencing?

1 Like

Hi @mikeloc ! Hope you are having a nice day.

Yes, I am trying to pass a newly-created thing to the next page and then display a certain image based on the 3 specific values in that things field. I have variables in the MC drop-downs as follows: 6 variables, 2 variables, and then 22 variables. Each combination has its own image I want to display, depending on the combination.

I would like the image to reference the combination of the 3 values in the thing’s field.

If that makes sense?!
Thanks again Mike! :clap: :+1:

For example, these two different value sets in the things field would show a different image on the next, output page.

Ah, that’s a much more interesting situation. Given that you have all of those combinations, I would think about using an option set or a custom data type (likely the latter) to define each combination of options and the corresponding image. Then, when you are constructing the expression for the image to display, you would do a search to match the thing for which you are trying to display an image to the thing in the data type with the same combination of options, and you should be good to go. Any of that make sense?

Ok, Step 1:

Result:

…repeat for every potential 3-value combination.

Is it ok to have so many data types?

TY-TO

Sorry, I wasn’t clear… just one custom data type, and then create things (records) within that custom data type for each of the combinations. But definitely don’t create a custom data type for each combination. :slight_smile:

1 Like

Where will the things be stored in the database? In the Options sets?

After you create your custom data type, go to the App data tab , select the newly-created data type, and start adding new entries to it in the database.

1 Like

Like so?

Dataset

App Data Creation

Yup! Oh, and I just had another thought… you could add a field to the data type where the user-created things will be stored, and that field would link to the Select-Set data type. Then, as things are created in the “user-facing” data type with their specific combinations, you could find the corresponding thing in the Select-Set data type during the creation workflow (via a step that makes changes to the newly-created thing). You would save the matched thing to the field I mentioned above, and you wouldn’t need any conditionals at all on the image element.

1 Like

Ha, thanks for your patience. I am really trying to get this! :woozy_face:

  1. Add field to data type where user-created things stored: User-Selection
  • Field would link to the Select-Set data type.
  1. As a thing is created in the “user-facing” data type (User-Selection) with specific combinations,
  • Things are created during submission of input by workflow, and then the next page is loaded
  1. Find the corresponding thing in the Select-Set data type during the creation workflow (via a step that makes changes to the newly-created thing).
  2. You would save the matched thing to the field I mentioned above,
  3. No conditionals on the image element.


You’re getting there. :slight_smile:

In the first screenshot, delete the Link field and create a new field (call it whatever you want) with a field type of Select-Set. Also, in the first screenshot, do the oil and shoreline fields need to be lists? If they can only store one value, there is no need for them to be lists, and if you want to make that change, you will have to delete the fields and create new ones that aren’t lists.

Your second screenshot looks good (although, it would need to change a bit if you delete the list fields and create new fields).

In the third screenshot, have the thing to change be the result of step 1 (get rid of Link at the end of the expression). Then, click the Change another field button and select the field that links to the Select-Set data type (i.e., the field I described at the beginning of this response). Finally, in the value for that field, do a search for a Select-Set:first item with constraints on the search where the field values from the result of step 1 match the fields in the Select-Set data type.

1 Like

:ok_hand:

Should I make these field types, the types in my options ex. Oil Type…as shown below, or should they be text?

Ok:

  1. Above question, do the field types need to be from the options list or text? ;

  2. Are the constraints on Step #3 correct?

TY in advance!

I think it’s looking good! Now, whenever you want to display the image associated with a thing in the User-Selection data type, you should be able to get the image by referencing the thing’s Link-Set's Image-Select.

1 Like

Ok, I got one of the images to load, but when i change the input options it’s the same image. So close!!!

Is my expression in the Image Element incorrect?
Is this a time when I should be using the Workflow to Show the Element?


You shouldn’t have to do a search for the image. On this page, how do you know which thing in the User-Selection data type you are referencing/displaying? Are you passing it to the page? Is it the data source of a group? If we know that, you will simply reference that thing and add Link-Set's Image-Select.

1 Like

Hmmm, you mean the user input selections?

This is where I probably need to know more about the user flow of your app, and we should probably take this out of the forum. If you want to send me a direct message, I’d be happy to keep helping to see if we can get this one across the finish line.