Evitar duplicados de mis empleados en la misma fecha

Good afternoon, I am making an employee control app in “glide” and I have had a problem for a long time that I cannot solve.
I have a screen called “REGISTRATION” in which I have the date, the entry and exit times, and in a “choice” component I have the employees which I have configured for multiple selections and thus not waste time making a registration by employee.

The problem I am facing is the following:
I need that when the employees have already been registered on a specific date, they do not appear again or that they are checked or that they cannot be selected to avoid an employee being registered twice on the same date. Is this possible?

I would appreciate if you help me

What you will need to do is apply a filter to your choice component so that it excludes those employees that are already registered for the selected date.

If you’re not sure how to do that, please provide a screenshot from the Glide Data Editor that shows the relevant table/s, and we will guide you.

I tried to apply filters to the component but I couldn’t achieve it

Are you able to provide some better quality screen shots please?
The column headers need to be readable.

adjunto imagenes

Okay, try this:

  • In your Registro table, create an if-then-else column:
    – If DIA is within today, then Empleados
  • In your Empleados table, create a relation column that matches Nombre Empleado with Empleados in your Registro table
  • Then use this relation column to filter your choice componet, so that it only shows employees where the relation is empty.

I was able to do all the steps correctly but when I add the relation filter the component completely disappears

That would mean that none of the employees meet the criteria.
But from looking at the dates in your earlier screen shot, that shouldn’t be the case.
So that suggests that something isn’t set up correctly.
Can you show me how you configured each of the if-then-else and relation columns please?

Also - just to check - would you always want to be checking this for the current date, or would you have the user first enter a date? (I assumed current date, as I don’t see any columns in your table that would hold a selected date).

In this case, a specific date must first be entered in the “DAY” field.
The record is not always made on the current date.

I attach the images


Sorry, my fault. I told you to configure the relation to match the Employee column with the Employee column in the Registrations table.
But what you should do is match it with the if-then-else column :man_facepalming:

Changing that will get it working for the current date.

To get it working for a user selected date, first:

  • How will the user select the date?
  • Where will the selected date be written?

ahhh, indeed now it works with the current date.
No problem.

In my case, the user will enter the date in a “date” field only to then enter the employees and the status of those employees.

I don’t know if I understand myself, just in case I’m attaching images.

Okay, those last two screen shots were very helpful, and now I have a much better understanding of your challenge.

I’m afraid that this is where things start getting a little complicated. Essentially what you are trying to do is check for duplicate entries before a user submits a form. Unfortunately, this isn’t possible when using the native form that Glide provides. This is because the values collected in the form are not written to the database until after the form is submitted. This means that even though the user has already selected a date, the value selected is not yet in the database, and so we can’t use it to compare to existing records.

However, there is a way around this, which involves using what is commonly known as a Custom Form.
I’ll describe as best as I can what you need to do to set this up.

  • Firstly, create two User Specific columns in your Registrations table
    – A date/time column: this will temporarily store the selected date
    – A text column: this will temporarily store the selected employee
  • Next, create a Single Value column in your Registrations table
    – This one should take the first value from the User Specific Date column and apply it to all rows
  • Now, modify the if-then-else column that you created earlier:
    – If DIA is within Single Value Date column, then Employee
  • Next you need to make some changes in the layout…
  • Firstly, instead of a “Show Form Screen”, you need to use a “Show New Screen → This Item” (note that I am assuming that your screen will always be attached to the first row in your Registrations table, which appears to be the case)
  • On that new Detail Screen, add the following components:
    – A Datepicker: the target for this should be the User Specific Date column
    – A Choice component: configure this one the same as you have now, with the same filter condition. BUT, change it so that it writes a value to the User Specific text column
    – A Button: this will be your “Save/Submit” button. It should have an action configured that Adds a Row to your Registrations table, using the two values that were temporarily saved in the User Specific Columns

Give that a try, and let me know how you get on.

1 Like