Hey there! In this guide, we'll explore how to return a list of mixed objects from different tables using Xano's no-code platform. This can be incredibly useful when you need to combine data from multiple sources into a single response.
First things first, you'll need to set up your data models in Xano. For this example, let's assume we have two tables: Info and User.
To retrieve data from multiple tables, we'll use the get record operation. Here's how you can do it:
get record operation onto the canvas.Info table from the "Table" dropdown.User table.You should now have two separate get record operations, one for each table.
Now that we have the data from both tables, it's time to combine them into a single array. Follow these steps:
combinedResult and set its type to array.push operation onto the canvas.push operation's configuration panel, select the combinedResult variable from the "Array" dropdown.get record operation (e.g., info1).get record operation (e.g., user1) to the "Value" field.Your canvas should now have a combinedResult array containing objects from both the Info and User tables.
Finally, we need to return the combinedResult array as the operation's output:
return operation onto the canvas.combinedResult variable to the "Value" field.And that's it! When you run this operation, Xano will return a list containing objects from both the Info and User tables, seamlessly combined into a single response.
By following these steps, you can easily create mixed lists of objects from different tables, enabling you to build more powerful and flexible applications with Xano's no-code platform.
Join 100,000+ people already building with Xano.
Start today and scale to millions.
Start building for free