Change Image dynamically

Can i change the shown image depending on a variable?

For example, i have diferent types of fruits, and every kind of fruit has his own barcode, what i want is that when i scanned the barcode and the app detects that the barcode belongs for example to an apple, the image of an apple appears on the screen, and the same for each type of fruit.
(this si just an example, is not my application).

Hey @Msaldivar7 ,

You can certainly do that! I’d recommend having a master table that holds your images. To go off this fruit example, I’d have something like the following:

ID   | Fruit Name | Image 
123  | Apple      | apple.png

You’re going to want your ID column to represent the barcode that’s going to be scanned. Then you’re going to want to build a trigger that will load the corresponding record (containing the image) based on the value of the scanned barcode.

Let me know if you have any questions on what that trigger would look!

Thanks for your response @Kailey .

I was thinking on something like that, but, when i add an image widget, it doesn’t show the trigger option, so i can’t set the image regarding the id, i can also made an image url variable, but i can’t find how to use that to show the image on the screen yet.

I believe you’ll want your trigger (that loads the image) to happen when a barcode is scanned.

Here’s an example:

This will dynamically load the record by the barcode scanned.

Then instead of inserting an Image onto the step (like you did in your previous post), you’ll want to embed the table record.
Click ‘Text’ > ‘Table Record’

Then from there I can assign that to be just the image column of my table record:

Let me know if you have any questions! :slight_smile:

That’s exactly what i need.
Thank you so much @Kailey

No problem! @Msaldivar7