How can I link a single uploaded image to multiple records
The scenario is as follows:
- I have a field in a table for status
- Status can only have 2 values, active and inactive
- I have uploaded 2 icons to public files, one for active and the other for inactive
How can I store the 'inactive' image against each record that is inactive?
Alternatively, when creating an endpoint returning the record with a status, how do I attach the 'inactive' image with an inactive status?
Essentially the question is, how do I use a single image against multiple records?
Best Answer
-
Hey there - sounds like this particular issue could be solved with an addon as the best method.
What I would do:
1) I would create a new table ofimages
. They would have the enums of active or inactive as a column, and another column for the actual image itself. I'd add two rows, one for inactive and one for active.
2) I'd create an addon that would search for this value, provided an enum value.
3) Then, in my query where I'm returning my data, in the output tab, I would add the addon we created in the previous step, ensuring that the data's active or inactive field is being supplied as the input for the addon.
Let me know if this aligns with what you're trying to accomplish!
Answers
-
Thank you Cameron.
I thought there would be a way to refer to an image by its URL but your approach will work perfectly.
Thank you.
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback