Change and delete data from a datalist

Hello Guys, I need some help!

I’m creating an app to control attendance at sports classes, it’s a personal project.
I currently have 3 tables:
Users - Used for trainers
Teams - Usadara for teams
Students - Used for students

My question is when I created the teams, I needed to include the students so I used a custom states to list these students temporarily before sending them to the database. Because now I want to change this data and/or remove them, but I’m not getting it, can someone help me?

  • Initially I thought of doing it the same way to include it, but I can’t get the data from the db and allocate it in a custom states.

Thanks!

Custom state to store students (type = students, is a list).
When student is chosen → add student to the custom state. When student is unchosen → delete student from the custom state.
At what point do you face a problem?

Hello, Thanks for the feedback!

I’m stuck in getting the data from the bank and going to the custom states of the popup, to later add more students or remove an existing one, would that be possible?

Custom states can’t have a dynamic data source by default. but what you can do is to have a WF on page load (or when some button is clicked) which set custom states value to be equal to Teams list of students.

perfect!
Thanks again for the feedback, WF would be workflow, right?
I did something similar but it didn’t load, can I print it and post it here?

yep

sure, you can post an image here


this is what i did…

I can see “popup” in you expression, do you call a popup in a repeating group?

In the case of this repeating group, it is inside a popup.
I name 90% of the elements to make it easier to find where they are, this repeating group only appears when a button is clicked.
The Parent popup is linked to the teams’ information, this repeater group is currently linked to the students table, but I’ve already tried it in the teams table but I couldn’t solve it, if you want I can add you to the project so you can better understand how I made this structure

You can pm me the link

I’ve just realised that I was thinking about another task and screw things up. You don’t need to assign students to custom state on page load.
Here are two approaches you can use:

  1. Create a custom state like “students_to_delete”. In your RG add a checkbox or an icon to select students that should be deleted. When icon is clicked → trigger action “set state” and in the value use expression “student_to_delete:plus item current cells student”. So you are accumulating a list of students to delete later.
  2. Just add an icon or button in the RG. As soon as user clicks on the button - trigger a WF to delete current cell’s student from the team. With this approach your are not accumulating users in a custom state to delete them later al at once. Instead you are just deleting students one-by-one.
1 Like

thank you very much for the tips… I’ll try one of these tips!

@artemzheg Thank you very much for your support, in the end it was very simple to load the data, something that I was not able to do. As I already forwarded the current cell referring to the team to the Popup, it was only necessary to forward it to the repeater group, now I’m having trouble deleting a student from the list, I’m studying the possibility of copying this list to a custom state and making the changes there and then send to the db. But in advance I want to thank you for your commitment to your help! Regards Alex

@artemzheg I managed to solve my problem, thank you for your help! When I understood the way WF works it became clearer, for the edits to insert and remove students I use WF directly, only for creating the teams that I am using custom states, so I list the students in it and when I click on the save button it loads all the data!

1 Like