[Solved] How to eliminate duplicates?

Options
I will try to make it as simple as possible 🙂

There is a table where I have some emails.

email1@test.com
email2@test.com
email3@test.com
email4@test.com
email5@test.com

When I submit a JSON:

{
  "contacts": [
    {
      "email": "email1@test.com"
    },
    {
      "email": "email2@test.com"
    },
    {
      "email": "email3@test.com"
    }
  ]
}

I want to get back something like:

{
  "contacts": [
    {
      "email": "email4@test.com"
    },
    {
      "email": "email5@test.com"
    }
  ]
}

I feel like it's not a complicated thing but I can't make it work 😠 🙂

I would appreciate a lot a loom or some kind of help!

Thx in advance!

Comments

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options
    So you want an api endpoint that when you send a list of emails, it checks which are in the database and returns those that are not in the database?

    To do this, I would
    0. Create a new variable called output of type array
    1. loop over the input array, and for each item
    2. extract the email value
    3. Run a get record on the database to see if there is matching value
    4. If there is not, add item to the end of output
    5. After the loop, return output

    you have your filter!

    If you want to work on this together I would expect it probably takes 20 minutes. I provide 1-1 mentoring services on statechange.ai
  • Gino
    Gino Member
    Options
    Thx Ray! It's working. I just need to change stuff according to how I need the data out but I think I will manage to do that.

    I would alos love to jump into some quick calls with someone but $100 for 20 minutes it's too much for me at the moment.

    Thx again for your help!
  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options
     I run free meetups (next one this afternoon) which are a mix of discussing no-code topics, showing off projects, and helping with hard problems.  If you are ok with the timing and discussing in public, you can get help without charge!  The next one is this afternoon - learn more about them here.