Deleting Item from Repeating Group w/out affecting Database

Hi!

I’m having trouble figuring out how to delete an item from a repeating group. For a bit of context, The group displays a list of Things, and these Things are visible to the entire Userbase:filtered by ‘Admin = no’ and ‘Accepted = no’. These non-Admin Users are able to either Accept or Decline these Things.

The issue I’m having is there’s 2 scenarios. The non-Admin User either Accepts the Thing, in which case I’m changing the field ‘Accepted = no’ to ‘Accepted = yes’ , so the Thing will then disappear from the orginal List due to being filtered out. This is ideal as once accepted, I do not wish other non-Admin users to be able to accept the same Thing.

The problem comes when I’m trying to create the “Decline” functionality. In my understanding I can’t simply have the non-Admin user click Decline and then delete the Thing, otherwise that will end up deleting the Thing from the actual Database and other non-Admin users will not be able to see it, even though it’s ‘Accepted’ has not been changed to ‘Yes’ yet.

Could anyone give me a tip on how to create this so that when the non-Admin user clicks Decline, it only removes this Thing for them, and not the entire userbase.

Thanks a lot! :slight_smile:

Add a field of active? Yes/No and filter out for “No”

1 Like

Could you expand on this, I dont fully understand. Do you mean an an Active field for the Thing and filter out inactive ones via ‘no’ in constraints?

If for example, if clicking the Delete button would render the Thing ‘Inactive’, would that not cause the entire Userbase to view the Thing as ‘Inactive’?
This would defeat the purpose since, as I definitely am trying to filter out deleted Things, I only want it to delete for the Current User, and not All Users.

So you have one data type for user, one for your ‘thing’ that you want users to accept or decline. What you need to do is create a third data type which joins the two and allows you to define a unique relationship between the user and the thing. So each user _thing records can have a unique status for accepting or declining.

1 Like

Okay, I see where you’re coming from. I’ll give it a shot! Thanks mate

Another way is to add to the User data type a new field (List of deleted_things), and whenever a user deletes a thing it gets added to the List of deleted things, then in your repeating group you can filter them out in the data source like this:
image

1 Like

Ahh okay I get the idea, there really is so much flexibility with these elements. Thank you Vlad!

Hey @vladlunasan , Just adding on to this topic with a further question. Say for example using ‘Records’, If i wanted to show only 5 ‘Records’ to my whole non Admin users, and only 5 could be accepted, and once they’d all been accepted the ‘Record’ would no longer show in the RG, how would you go about this?

The semi-solution I’ve been trying to work with is to create a ‘participant’ field underneath that ‘Record’ data type and when the ‘Record’ is paid for, it will appear under the RG showing acceptable ‘Records’. The trouble is im struggling to figureout how to connect the Participants, applying a maximum limit to how many can complete a ‘Record’, to the ‘Record’.

Wondering if you could shed some light onto this, Thanks!

Yeah you are on the right track, in that case i would add two fields to the “Record” data type:
· Participants (list of Users)
· Accepted (yes/no) => Will be used to filter the RG’s

  1. When a participant clicks and accepts a Record, make sure to add the current_user(participant) to the Record Participants list.
  2. Add an additional step in the same workflow that updates the Record Accepted field(Make changes to thing) with the condition “Only when” Record_Participants:count >= 5.
1 Like

Thanks again Vlad!

1 Like

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