In Xano, you can use add-ons to retrieve related data from other tables based on a specific condition. This is particularly useful when you have a one-to-many or many-to-many relationship between your data models. For example, let's say you have a companies table and a campaigns table, where a company can belong to multiple campaigns, and a campaign can have multiple companies.
Before creating an add-on, it's essential to understand the relationship between your data models. In our example, the campaigns table has an array of table references to different companies. This means that a single campaign can be associated with multiple companies, and a company can belong to multiple campaigns.
Xano provides a built-in wizard for creating simple add-ons, which is suitable for most use cases. However, when dealing with more complex data relationships, such as an array of table references, you'll need to create an add-on from the library to have more control over the query.
To create an add-on from the library, follow these steps:
companies table).After creating the add-on, you'll be presented with the add-on configuration interface. Here, you can set up the input parameters and define the query to retrieve the related data.
company_id).in operator to check if the company_id is present in the array of company IDs for each campaign.input.company_id in company_id
This query will return all campaigns where the company_id matches the input company_id.
campaign_name and campaign_id).After configuring the add-on, you can use it in your API to retrieve the related data.
companies table).company_id) to the appropriate field from your table.campaigns table for each company.By following these steps, you can easily retrieve related data from other tables in Xano using add-ons. This powerful feature allows you to build complex data models and relationships without writing any code.
Remember, Xano is designed to be user-friendly and accessible to both non-technical users and developers. With its visual interface and intuitive features like add-ons, you can quickly build and deploy backend services for your web and mobile applications.
Join 100,000+ people already building with Xano.
Start today and scale to millions.
Start building for free