Moving map from address to address after inputting data on property (Repeating Group and Custom State Issue)

I have a list of addresses in a database that are numbered, starting with 1. I want to load the first address on a map. When a user looks at this address on a map and inputs some information on the property (the number of stories), I want the user to click next which will advance the map to the next address (number 2) so they can input the number of stories for that property. This goes on and on. Once data is entered for any given property, I want that property to be excluded from ever showing on the map again.

I currently have a repeating group listing the address’s number. When a user enters info and presses next, the data is saved and the repeating group advances to the next entry using a workflow. This changes the state of the repeating group from the starting number to the next number by adding 1.

The problem I am having is the map is advancing, and the address number is advancing, but the input values are being stored on the wrong address. The easiest way to see this is by entering the same number in the stories input as the address number that is being displayed.

I would really appreciate any and all help and suggestions if there is an easier way to do this!

Here’s the editor: https://bubble.io/page?name=index&id=mapviewer&tab=tabs-1

@yamedia I tried to replicate your logic from another answer with no luck. Any idea what I did wrong?

PS - I loaded all the data with “0” in the stories column so that I can easily identify which ones have not been looked at yet

Hi @josh5 :slight_smile: Your setup looks correct! The main reason the map was not moving to the next address is because the map needs to be inside of a group, that is reset each time “Next” is clicked (I didn’t realize this previously either). I’ve added the group here:

And added the reset action in the workflow here:

The inputs are now also in that Group as well, since the map and inputs are all referring to the same Address File Thing.

Since the data source of that group is “Do a Search for Address Files” (constraint: number = RG custom state number):first item, we can use “Parent Group’s (x)” to dynamically display the Address File’s address on the map (using "Parent Group Address File’s Geo Address):

We can use this approach for the Inputs as well, using:
“Parent Group Address File’s Number”
“Parent Group Address File’s Stories” and
“Parent Group Address Files’s Notes”

to display those field values of the Address File that is currently being looked at by the User:

Last but not least! Since we can use “Parent Group’s Address File” to dynamically display information on the page, we can set that as the “Address File Thing” in the Make Changes to a Thing action in the Next Button workflow event:

And that should work! :slight_smile: Feel free to let me know if you have any questions!

1 Like

YOU ARE BRILLIANT!! I cannot thank you enough. the bubble community continues to restore my faith in humanity :wink:

This was incredibly helpful as is, but I do just have 2 followup questions if you have time:

  1. I’m confused why upon page load, the count goes back to the initial value - even when I have already marked the number of stories on that property. I thought my workflow triggered upon page load would prevent this:

  1. Why does the “Current Cell’s Number” (40 in the pic) not match that of the RG’s state? I guess I do not understand what this number is then if not the current state.

Thank you so so much!

1 Like

Aw, so glad to hear it was helpful!! It’s my pleasure! :smiley:

Ah, got it! This is because the current search checks to see which properties have a Stories number that is “greater than 0”. It sounds like you are looking for Properties that have a Stories Number value equal to 0? Instead the constraint would be “Stories number = 0”:

My apologies, I didn’t look at this repeating group before. The Address File numbers didn’t match before because this RG had the correct, “Stories number = 0” constraint, while the page load custom state had the “Stories number > 0” constraint. Now that they match, they’ll both show the same results :slight_smile:

I added another text on the page which shows you the :count of Address Files remaining where the “Stories number = 0”:

And the text beneath that shows the Total Amount of Address Files (no constraints in that search)

I think it all matches up now, but let me know if not! :slight_smile:

1 Like

Ah! What a dumb mistake regarding the >o! Thank you for catching that.

I’m still having a problem with the counts not matching. I guess it doesn’t really matter as everything is working correctly but I’m confused what the number in black (Current Cell’s Number) is actually referring to then. Any idea? If not, I can delete and just use the Parent Group Address File Number in white.

Thank you again!!!

Not dumb at all! (I do the exact same thing!) It’s no problem! :slight_smile:

And ohh! I see now. This is because of the ‘Show Next’ workflow for that repeating group. The repeating group was already set to display the Address File thing that has “Stories number = 0”, so you don’t need that ‘Show Next’ workflow.

In summary, each time Next was clicked, the repeating group would update automatically to the correct Number, but then ‘Show Next’ would skip that correct number and go to the one after that.

It seems to work for me now, but let me know if it is does for you as well! :slight_smile:

1 Like

Ah! Ok! this is working great now!

Thank you again for the amazing support! :slight_smile: :slight_smile:

1 Like

Awesome! No problem at all! :grinning:

@josh5 Just realized I should add something. Since you are just looking to go to the ‘next’ Address File thing (where the Stories number = 0), you don’t necessarily need a custom state at all (to increment by 1).

Instead, you can set the data source of the Group Map element to be the same as that side repeating group: "Do a Search for Address Files (constraint Stories number = 0):first item (using :firstitem here since it’s a group that displays a single item, not a repeating group). As you saw with that side repeating group, the ‘next’ Address File thing will already be displayed after Next is clicked, since the previous Address File thing was assigned a value for their “Stories number” field, and they no longer meet the search criteria.

Then remove the custom state actions completely. You’ll get the same result, and it’s probably a less confusing set up! :slight_smile:

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