How to cycle through a set number of images in order?

Hey All,

I feel like this has to have been answered before, but I can’t find it - I have an inline tile list, and each list item will have been generated by a user filling out a form. I have made 8 separate background images for these tiles. I would like to set it up so that if a user has for example two list items, the background images would be image1 and image2 in that order. Five list items would result in images 1-5 in order. Any number of list items over 8 would start the images over from image1. So 10 list items would result in tiles 1-8 displaying images 1-8, but then list item #9 would show image1 and list item #10 would show image2, and so on…

Currently the only thing I’ve been able to figure out is how to set the image to “random” but this too often results in juxtaposed repeated images. (I have the 8 image urls on a separate sheet being accessed by a single value column set to random)

I thought setting the single value column “from start” was the answer but that doesn’t seem to be that option’s function. Any other option besides “random” results in one repeated image :thinking:

What is the easiest way to accomplish this? Thanks in advance! :pray:t2:

Randomized images - how can I change this to cycled images to avoid close repeats?

I assume you’re storing the users’ submissions within a single sheet, right?

Then what we can do is use an XC column to derive the “order number” of each submission, then a math column to turn it into 1, 2, 3, 4, … , 8, 1, 2, …

Does this solve your problem? It might take a bit of time to code the column but I may find time to help.

1 Like

yeah, assigning each list item a number is the key here. Then that can be passed as a parameter to the single value column to fetch the appropriate image.

I’m kinda thinking that this might be possible without resorting to XC…

1 Like

I thought so, we can theoretically add a number column in there, but I also thought what if someone deletes an item and it breaks up the whole thing.

Let’s say if I delete item 2 from the screen does it make item 3 become item 2 or not. If it’s not needed then we can do without XC.

1 Like

yeah, the numbering needs to be dynamic.
Presumably also the table contains items that belong to several users all mixed in together, so any sort of static numbering wouldn’t work, or would be too fragile.

1 Like

@ThinhDinh @Darren_Murphy I realized I left out some pertinent info - this is a glide sheet! (And has to remain a Glide sheet for privacy reasons) I can research XC columns but I’m thinking that’s a feature native to Google sheets and not Glide? (I am far from advanced)

Any numbering would yes need to be dynamic in case items were to be deleted, also each list is individual to the user :+1:t2:

Sorry I should have been more specific :woman_facepalming:t2:

That’s fine, XC columns are Glide computed columns, so only available in Glide anyway.
But that’s useful to know as it rules out any options involving Google Sheets.

I’m not sure if I can come up with a solution that doesn’t involve XC, but I’ll have a fiddle. It’s an interesting challenge, and I like interesting challenges :wink:


It just hit me that XC is community jargon for the experimental code column - I should have known that! Beyond html I am at best a preschool-level coder, though occasionally I can muddle through with stack overflow.

If it makes things easier I could get away with static numbering - maybe something involving a set-column action on the form submit? I can’t quite work this out in my head though :woozy_face: