How to assign users in a event

Hello, I need help. I have an app with 3 types of users: ‘admin’, ‘staff’, and ‘event host’. The app has an events section. As an admin user, I need to assign users with the ‘staff’ role to specific events. That means, I enter a particular event, and in the details, there’s a button ‘ADD STAFF’. When I tap it, a new view opens with all users who have the ‘Staff’ role. This is where I want to select the user for the event, but I don’t know how to do it.
I have a table ‘EVENTS’ with all the event information and ‘USERS’ with their respective information.
How can I do this?



Looking at your third image, I think you just need to add a choice component inside your “Add” form.

I do that but it adds a new row in users. What I want is to assign events to existing ‘staff’ users.

Have you specified the destination on your form?

Yes, I have the form targeted at the USERS table.

Determine the destination according to the table destination for your staff-events, not for users table.

I changed it to the Events table and it still adds a new row. I don’t know what else to do.

If the add form by default adds a new row, it is different from the edit form. If you only want to add values to existing columns and rows, use the edit form. Please describe what you want and provide a screenshot of your target table. Besides the Users and Events tables, do you have a Staff table?

I managed to solve it, but it only lets me add one event per STAFF USER, and I would like to be able to add as many events as I want.

I assume and suggest you have three tables: user, event, and staff.

  1. You can still add as many events as you want to the event table.
  2. In the staff table, you need to have a column “event” that contains the names of all staff involved in a particular event. This will be useful for relating to the event table.
  3. In the detail layout of the event, you can add a collection based on the source from the relation of the event name to the event-staff. Or you can simply use a filter if your source is directly on the event table and not a relation: event is screen > event. Create an Add form in this section to add staff to a particular event.

In your second screen with the staff button, make sure the action on that button is ‘Show New Screen’ → ‘This Item’.

On that new screen, add a choice component sourced from the Staff table. Have it write the choice value to a column in the events table. It would be best to display the staff names, but write the row ID for the staff to to the colum. The goal is to get a comma delimited list of chosen staff IDs written to a column in the Events table.

Once you have that comma delimited list of rowIDs for each event in the Events table, use a Split Text column to convert it into an array. Then you can use the array of staff IDs for relations between the Events and Staff tables.

2 Likes

Hi, I followed your recommendation, but it only lets me save one ID. The choice is fixed to one ID. It gets written in the events column, but it stays fixed and doesn’t let me choose another ID for the same event.


x2

Did you enable multi-select on the Choice component?

3 Likes

:sweat_smile:

You can also change the choice component to display names, but still write the ID, so it’s a little more friendly.

1 Like

Alright, now I have the event tickets. How can I display the tickets according to the event assigned to each USER STAFF?

There are 2 collections as indicated by the green arrow, where one shows the general tickets and the other would be for the view of each STAFF USER, allowing them to see only the tickets of the event they were assigned to.

Create a split text column to split the list of staff IDs in the Events table to an array.

In your Staff table, create a relation from the rowID to the array you created above in the Events table, make it a multiple match.

Then you should be able to show tickets of events each staff is assigned to using the relation.

2 Likes

I have all of that in the Events table. I also have the relation you mentioned, but in the second TICKETS collection, I use that relation, and it shows the events assigned to the STAFF user. This was already working in another component.

What I need is to add another ticket list (the one above is for users without a role), but to filter the tickets only for the event assigned to the STAFF user (considering that I am viewing the application as a STAFF user).

You should be able to use a filter on the Collection that is something like “staffIDS includes User Profile->RowID”

By doing this, the collection only shows me the events related to the user, and that’s not what I’m looking for. I’m looking to only display the tickets that belong to the event to which the user was assigned.