Increment one line but some lines must not show

Sheets challenge for me.

I would like to show a list of images - one image at a time - I was thinking of using the image component. Some of the images can be set to Hide, so they should not be shown. I would like to use an increment action so each time I click on a button the next image should be shown.

The increment action works nicely when all images are to be shown (using UID from below table) - but when some are not to be shown - and then the problem arises. I thought about doing an extra column (Value to use by the increment button) telling which is the next image to show - and do a relation lookout where only I get the row where Hide=No

How could this be solved - anyone?

UID Image id Hide Value to use by the increment button
1 image1 Yes 0
2 image2 No 1
3 image3 Yes 0
4 image4 No 2
5 image5 No 3

Using a similar setup as @Manan_Mehta did

@Jeff_Hager is this solvable, you think?

Take another look at the link in this post and make a copy. I use a helper sheet with unique to get the list images without empty rows, then vlookups to get the determined columns used for a relation back to the original sheet. You could probably do something similar with a query in a helper sheet, some formula to get the row number, then a vlookup to get the row number back into the original sheet.

I will try to help Krivo with a sheet version of that idea when I get to the laptop later today.

I was working on something pretty similar but did not require an increment, but complex visibility based on each user and I hope I can share that with you guys as well soon.

1 Like

@ThinhDinh that would be great.
Tried to use @Jeff_Hager idea with a helper sheet - I didn’t get it to work as I wanted to get some variables which were only found in the builder. And is will also take a lot of rows :frowning:

I will stop for now as it is getting late (@ThinhDinh it is very late in Vietnam I believe :sleeping: ah - it might actually be morning :slight_smile: )

1 Like

Ah it’s 5.30am man, just woke up. Have a good sleep and a great week :blush:

1 Like

Just keep in mind that a helper sheet would not be used by glide, so it shouldn’t count against rows. It would only be used internally in the Google sheet.

1 Like

@Jeff_Hager understood :+1:

1 Like

Hi Krivo, here’s the sheet I worked on as promised.

I used an arrayformula in cell C1 to only incrementally count the rows where the “Hide?” value is FALSE.

1 Like

@ThinhDinh thx a lot. Looks great. I have one problem through. The “inactive” field is a simple text field until glide writes to the field whereafter it is a boolean field. If I make the whole column booleans then I will get all to many rows as glide will think it has values. So how to avoid that?
Maybe I should change the formula so FALSE or empty string is found in the cell. But i’m not sure that the countifs will work then. Any hints/ideas?

(your formula)

={“Increment value”;ARRAYFORMULA(IF(B2:B<>“”,IF(B2:B=FALSE,COUNTIFS(B2:B,FALSE,ROW(B2:B),“<=”&ROW(B2:B)),0),“”))}

`

I think you can keep the old flow and make sure these things are done:

  • Remove all the empty rows.
  • Go to Data > Data validation, choose the range to be B2:B (in my case it’s column B), choose checkbox.

image

When you add a new row, it will honour the checkbox settings and its default value is now a FALSE (as in to be shown in your case).

image