Associate a number to an image in CMS

I will import a large csv with one of the columns containing a score of between 1-5. I want the collection item page to show this number, but also include an image next to the score that goes with that score. Ie all the 1s are next to an image of a red trophy, the 2s a blue trophy, 3s a green trophy and so on up to 5.

Can this be achieved with a reference field ?

Many thanks!

Here is my public share link: LINK
(how to access public share link)

If there are only 5, the easiest solution is probably to put 5 images in your document and use conditional visibility to show only the one representing the number of the current item.

Otherwise, yes, you could create a separate collection, give it slugs 1 to 5 plus your image, single-ref to it, and you should be able to load your CSV successfully, matching that numeric field to the ref field you’re populating.

Ok got it!. I’d set the conditionality to be something like “show this image if the [score field] equals [1 or 2 etc]”

Many thanks!

1 Like