How to remove objects from list of entries that match another list of entry values?

Options

I have two database. One that contains a list of companies and their associated emails and other information. In the other I have a list of user_id with company_ids that correspond with companies in the first database. I need a way to remove any companies (via Query All Record variable) in the first database of companies whose id matches company_id.

I am looking to figure out how to remove objects from from a list containing key value pair objects that match the list of values from the second database.

The logic I have is pretty straight forward and easy to build with actual code, but with the way Xano is setup is making it unnecessarily difficult. If there is a better way to go about this in Xano I would appreciate any of those suggestions as well.

Answers

  • Pawel Magdanski
    Pawel Magdanski Member ✭✭✭
    Options

    I'm not completely sure if I understand this correctly. So you want to query the second table (user_id + company_ids) and remove from the first table those companies which ids was found in the records of the second one?

  • glotek
    glotek Member
    Options

    Yes, since new entries are taken from the first database every day the second table store the id numbers of ones that have already been used so that they are not used again.

  • Pawel Magdanski
    Pawel Magdanski Member ✭✭✭
    Options

    I would say then to create an empty array, loop through al the records from this second table and append the company_ids to this array then loop through them (if necessary check if comany still exists) and delete them.