Listing occurrence on database

Hi everybody!
can anyone help me?
I have a number field in my database called “employee registration number”.
I need to show in a field all numbers that appear more than 3 times in this database list, how can I do that?
Thanks

Hi there, @marciorahn… I could easily be misinterpreting your post, and even if I do understand it correctly, my suggested “solution” could be a terrible idea. Those things being said, what the heck, I’ll give it a shot.

It sounds like you have a number field, and the number in that field does not have to be unique across things (users, I assume). When the number in that field for a particular thing is the same as the number for at least three other things, you want to show that number in a list. Now, not that any of that makes any sense to me from a practical perspective, but is that even close to what you are trying to do? If so, I might go about it as follows.

Rather than try to figure out on the fly if a particular number has been used more than three times, I might have another number field (with a default value of 1) that is a counter that stores the number of times a particular number has been used. So, when a new thing is created and an employee registration number is assigned, I would check to see if that number has been used before. If it has, I would increment that thing’s counter field by one.

With the counter field in place, you could get a list of the employee registration numbers that have been used more than three times with the expression Search for Things:converted to list's employee registration number, and the constraint on the search would be counter field > 3.

Anyway, my apologies if none of that makes any sense, but again, I gave it a shot. I hope that reading it wasn’t a complete waste of your time. :slight_smile:

Best…
Mike

1 Like

Hey @mikeloc Thank u so much for your attention
Your ideia has already helped me a lot… Guided my ideas! I’ll do as you suggest, another number filed counter. what would be the best command line to perform this action whenever a new employee record is created? Any tips?
And just to better explain my need: I have a list in the database of all employees who have been through in doctor’s room, some of them have been through it several times, and I need to show those who have been through 3x or more

Thanks!!

Ah, okay… for some reason, I was thinking of a scenario where the same employee registration number could be assigned to multiple employees (which makes no sense, I know), and you needed to get a list of the numbers that have been used more than three times. Ug, that was a pretty ridiculous thought process on my part.

Given the additional information, I might still go with the counter field just to make it easier to get the list of employees. When a new thing is created in the data type where you are tracking trips through the doctor’s room, you would need a workflow step that sets the newly created thing’s counter to another thing’s counter plus one only when a search through the data type for another thing (the last thing, that is) with the same employee registration number is found. Does that make sense?

1 Like

Yea! Exactly!

1 Like

Did it!! Worked out!
Credits to @mikeloc

1 Like