Unique user
Question

How to validate is it unique mobile number, email id and unique user?

Solution

Hi Sowparnika

In order to validate if a user has unique data you need to make a query in the database, you can make a server action for this purpose.

I'm assuming that you need this in some kind of form where you are updating or creating a user.

My suggestion is to create a server action with an aggregate in it similar to this:

The idea is to look into the database to find another user with the same Email and PhoneNumber.

Cheers.
Luís Almeida

If you want to check if is unique, you can use the list index of


You put the condition to see if there is the same mobile and if returns -1 that's because it's unique among users. And you do the same thing for the other fields.

You can do it with aggregates, but you don't need to go server-side to do that query.

Regards,

Márcio

Hey Marcio,

You mentioned that

"You put the condition to see if there is the same mobile and if returns -1 that's because it's unique among users. And you do the same thing for the other fields.

You can do it with aggregates, but you don't need to go server-side to do that query."


Of course that you need to go into the database to get this data.


Your solution can work... but only if you have the FULL list of users loaded from a query, what happens when you have 1 million users?


Not even mentioning that you are recommending using multiple ListIndexOf to get the uniqueness of the user.


Cheers,

Luís Almeida



I just was trying to avoid calling the server-side. But when you talk about millions of users I understand. If so, I will say that the best thing to do is Advance SQL in cases of performance too...

I think the author of this question wants to check the uniqueness of each field for email and mobile. Let me know if I am wrong! :)

Thank you for your reply

Kind Regards,

Márcio

Even if the database has 10 records, you don't want to fetch the list of users from the database THEN  run multiple ListIndexOf to find the uniqueness of the data.

I believe the OP wants to know if an email and mobile phone number are unique, they can either to what I recommended and that way they will find users with the same email and mobile phone number or they can do
User.Email = Email OR User.MobilePhone =PhoneNumber , in order to find any user that have either the same Email or the same PhoneNumber

mvp_badge
MVP

And Outside of performance this would raise some eyebrows at the GDRP department

Thanks, guys, I really appreciate the explanation and the support.

Sowparnika saravanan I support the answer of @Luis Almeida.

Solution

Hi Sowparnika

In order to validate if a user has unique data you need to make a query in the database, you can make a server action for this purpose.

I'm assuming that you need this in some kind of form where you are updating or creating a user.

My suggestion is to create a server action with an aggregate in it similar to this:

The idea is to look into the database to find another user with the same Email and PhoneNumber.

Cheers.
Luís Almeida

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.