Reference Repeating group's repeating group's current data type

Hi

I have spent the last week making a photo tagger. I have a hotel listing site and wanted to allow the property manager to tag the different photos.

All things work as hoped except for two functions. The one I am focused on at the moment is allowing a user to delete an item from a list of items as a data field from the current data type in a repeating group.

This is what I have going on:

Firstly, I have in the database a Data Type of Photos with a Data Field Room ID which is a list of texts. ( I might want to change this to be a list of Property Rooms, which is a Data Type that has a Data Field of Room ID ).

Also in the database is a Data Type of Property Photos:

Another Data Type of Room Photos:

As well as a Data Type of Property Rooms:

Then on the page I have the following setup to display this information (currently I have more than what I will ultimately, but this is for testing purposes)

This is displaying all photos in the Data Type of Property Photos:

Next I have displayed the photo list of each property room:

What I am doing for functionality is to allow a user to click the trash icon in the cell of the photo in the property room to open a popup that gives them 4 options of deleting the photo. One option is to delete it from the current room (the room the photo displayed in the repeating group on page, the one they clicked the trash icon from).

A second option is delete the photo from all rooms it is listed on. This works fine. A third option is delete the room from the Property Photos list which also works fine. The last option is to delete the photo entirely, which also works fine.

So, the problem is getting the photo to be deleted from the room which is displayed in the repeating group containing the trash icon they clicked. This is an issue because each photo has a list of room ID’s and not just one. So, when trying to reference the room ID of the repeating group containing the clicked trash icon I can not.

I’ve tried to do custom states, but can’t find a way to set a custom state that is equal to the Room ID of the room displayed in the repeating group.

I have successfully allowed the user to delete a room from a single room in another popup which is the Photo Tagger popup. This was successful because the function runs a checkbox input value being changed, and the checkbox is in a repeating group of Property Rooms, so I was able to reference current cell’s property room.

I know it is not a necessary function for the user, but I am hard headed and want the app to do what I want it to do. Really hoping somebody might have a work around for this.

This is a link to my app for viewing:

https://bubble.io/page?type=page&name=admin_property_photos&id=photo-tagger&tab=tabs-1

If you want to view it as a user would and see the functionality you would want to follow this link:

https://photo-tagger.bubbleapps.io/version-test/admin_property_photos?property_id=6LOK1OX

Maybe this will help …

If you have a group in a cell, referencing the cell’s data item, all other elements in the cell and all their children elements can refer to that group, without needing to be contained in the group.

Thanks for the idea @mishav

I tried to make it work. I got it to function one way, which is not exactly what I am after.

First I was unable in the workflow to reference to the group in the cell, so what I did was “force it”. This has happened to me a few times and I create a different workflow on a different element and then copy the actions.

What I had to do first was create a new trash icon in the repeating group:

I also as per your recommendation added a group in the cell of the repeating group to reference the cell’s data item:

After that in the workflows performed the following:

This worked as hoped, however the problem is that I am wanting the action in the workflow to be triggered from a button in a popup that is displayed on the click of the trash icon. So, I then tried to “force” this by creating the same but slightly altered workflow actions.

Instead of referencing the current cell’s photo (can’t do it as the action is from a button on a popup) I sent the photo to a different popup (photo tagger popup) to reference the photo.

This worked to remove the photo from the Room Photo’s list of photos. It also removed it from the Property Room’s list of photos. The problem however is that since there are multiple “Group Reference Room ID” ( ie: it’s in repeating group cell ) and there is no way to reference the “Current Cell Group Reference Room ID” because the workflow is triggered off a button in a popup.

And because each of these Group Reference Room ID has a different Room ID it references to, the photo is removed from all Property Room’s list of photos and removed from all Room Photo’s list of photos.

Also, the Room ID is not removed from the Data Type Photo’s list of Room IDs.

At this stage I am really confused on how to from the popup button getting pressed create the workflow actions that would signal which room should be altered.

(I JUST HAD AN IDEA AS I WROTE THE PREVIOUS PARAGRAPH! I think maybe I could create a custom state on the popup that contains the delete button when the trash icon is clicked. This custom state would be the room ID)

I just tried setting custom states. There is no way to set it since every reference will be to the current cell’s photo.

I have a repeating group of photos inside a repeating group of property rooms.

The parent repeating group of property rooms is where I would get the room id from. However, the trash icon to click is in the child repeating group of photos.

So in the workflow for actions off the trash icon, every current cell references to a photo (which has multiple room ids)

I’ve tried to find ways to set the custom state value of the parent repeating group of property room but can’t seem to get it to reference current cell’s property room’s room id since I always get a current cell of photo.

Hi @boston85719

I setup a minimal example page, to show how to reference parents of RG cells. Once the workflow has a reference, it can set that reference anywhere on the page, including a custom state, which your popup could then pick up.

edit: forum4 | Bubble Editor
preview: https://forum4.bubbleapps.io/version-test/rg-in-rg?debug_mode=true

Hi @mishav

Thanks a lot for this. I just made a copy of this to play around with more. Will try to incorporate into my app tomorrow.

Cheers

Matt