How to filter out certain records based on a join / add-on
Hi there
I'm a noob so please forgive what is likely a basic question.
Refer to the attached images. I am trying to create an API that will return all Users that do not have a subsidy for an input business_id. As you can see, each subsidy record has both a user_id and a business_id.
My API is getting all Users fine, and I am able to create an add-on that returns all subsidies for each user. But I can't figure out how to then filter out users that already have a subsidy for the input business_id.
I basically need to filter our user records where subsidies.business_id = the input business_id.
Any help appreciated!
Thanks.
Best Answer
-
Thanks Pawel. I was actually able to figure it out using a simpler method that @Ray Deck mentioned in this post, which happened to be from you originally:
I used a two-step process to first retrieve all the subsidies for the input businesses_id, and then I retrieved users whose user_id is not in that returned list of subsidies.
Answers
-
I tried the 'Array: Find All Elements" function, but getting an error:
-
One thing is that you join two tables in you query via join feature, then you will be able to use it in your custom conditions.
Regarding you error try to use get filter on business_id:in condition it should look like this. $this.subsidies → get filter → business_id
This way even if the subsidies list is empty and there is no path to business id it will not throw and error
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback