Hello Airtable Community,
I hope this message finds you well. I'm currently working on a project where I've implemented a referral code system in Airtable, and I could use some guidance on handling potential duplicates.
Here's a brief overview of the situation: I generate referral codes in the format "Four letters of firstname, -D, and last 2 digits of the phone number." For instance, if I have a user named Johnathan with the phone number ending in 19, the referral code would be JOHN-D19. If i have another user named John with the phone number ending in 19, the referral code would also be JOHN-D19.
Now, the challenge I'm facing is that I want to avoid assigning the same referral code to different individuals. To achieve this, I'm looking for a solution to identify and handle duplicates. Here's the logic I'm aiming for:
Identify Duplicate Referral Codes:
- If the referral code is duplicated, proceed to the next step.
Check for Same Person:
- Compare the email and phone number associated with the duplicated referral codes.
- If both the email and phone number match, it means it's the same person, and the referral code remains unchanged.
Handle Different Phone Numbers:
- If only the last 2 digits of the phone number are the same, increment the last 2 digits of the referral code by 1.
I'm struggling with implementing this logic in Airtable, and I would greatly appreciate any insights, tips, or examples that could help me achieve this goal. Your expertise and support mean a lot to me.
Thank you in advance for your assistance!
Michel Youssef