Click to change state IF

Ive been racking my brain to find the answer

I have a page with 12 buttons on. i want to click a button which will change the state to YES or SELECTED but only if a certain data cell contains the same number as the button

SO button 1 is a TEXT field and is a number from a ROW in database
I want to click it and select this and change its state but only if the number matches to another row in the database

Hi @itsrobertwhite

I am going to take a guess as I do not follow well what you are kindly describing. Here it goes:

  • A repeating group searches for a thing that has a number field and a yes/no field. You show that data via text elements and a button on each row of the repeating group.
  • You want to allow the user to press a button and select the thing of the row only if the thing has a yes value in its yes/no field.
  • I am also going to assume that many things can be selected in that repeating group

Considering the above is so, then please review as follows:

  • Set a custom state in the page (or in any group you like) of type thing and set it to be a list. So … the state will be a list of things of the thing. When you choose each thing in the repeating group they should be added or substracted here
  • Set the button’s condition to “when current cell’s thing yes/no field is yes then this button is clickable”
  • Create one flow upon the click of the button to set a custom state to add the thing to page’s list of things if the thing of the row is not contained in the custom state. And create a second flow to subtract it when it is contained.

You can watch how to add/remove items from a repeating group in this video from the good folks from Zeroqode @levon How to Add/Remove Items from repeating group in Bubble

Hope this helps :+1:

You are so kind thank you i will have a go now.

i am trying to achive this:

CUSTOMER has 4 random numbers on their customer page and admin backend can click a number button on another page and it will highlight all customers with that numbers number and change its colour or background , any help would be great to make this happen to all users of the app

Lets see if I understand:

  • A customer thing has a field of numbers with content being 4 random numbers in a page called customer
  • In an admin page a user can click a button that shows those numbers below it

This other part is unclear:

  • There is another page where the user can click the above button and all the customer things with that number change their color.
  • … I do not understand … there are 3 pages

Suggestion:

  • Build a UI with the planned pages and elements
  • Build a data structure to support your vision
  • Try to build as much logic as you can
  • Share screenshots and state where you are if you hit any roadblocks
  • There will be more structure to understand what you want so that more assertive suggestions can be provided

Wow thanks for the quick reply ill try get screenshots for you now.

2 Pages one for customer game
one for admin control

So when admin clicks button number 4 all customers with number 4 on their page highlights

This topic was automatically closed after 70 days. New replies are no longer allowed.