Getting Data from Two or More Tables

Hello,

I have two tables in my database, Companies AND Users. I want to create a table that shows all of my users, and then I want to show the company name next to that user. Right now my table is setup to pull from Users Table, when I try to display the company name, I am only getting the primary key for the Row from Xano, not the company name. How do I solve this problem?

Thanks!

1 Like

@patopt

Two options:

  1. Backend: There are several ways to do this inside of your backend, but because you are using Xano, probably the easiest is to use Addons. This will give you the ability to simply “attach” your company to the user based on the account ID of the user. Xano has great documentation on this. As well, they hold office hours and can help you get this set up.
  1. Front End: If you wanted to do this on the front end, you could create two API endpoints in Xano. One for users, and one for Companies. Then, call those endpoints inside of WeWeb. Now, you have all of the information you need inside of WeWeb, so you could use the NoCode array functions to combine the data. If you want more of a walk through on this, let me know. My guess though is that you probably want to use option 1 inside of Xano.
4 Likes

WOW that was easy for option 1. Thank you!!

4 Likes

Kevin, you rock star. Option 1 just changed everything…removed a massive amount of complication. THANK YOU!

2 Likes

Hi kevin, is the addon is used for the GET request only? If I want to POST data to many linked tables how would I do that? For example, I want to send an ‘order’, so I need to send data of ‘products’ from ‘products’ table, ‘customer’ from ‘customers’ table and total price to ‘orders’ table which is already linked to those two. How can I do that?

There are several ways to send the data to Xano. You can send them as one object and nested items inside it. Or, you can send them all as separate objects.

Ultimately, you will need to process them in Xano by creating a record for each object and linking them by the record id.

You want to create the objects that you need the id’s for first.

You can then output the data with the addons in the output tab in Xano.

2 Likes

understood. Thank you so much

Hey Kevin, a related ask to khairul’s question. I’m able to POST new records to Xano fine as long as I don’t have a date field in my form. Any coaching on how to edit the date format? Specifically, my form has a date picker that shows a value like this: “Wed Aug 24 2022 00:00:00 GMT-0700 (Pacific Daylight Time)”. My xano records show as “Aug 24, 2022”.

I don’t understand if this is what is making my POST fail, but all the other fields seem fine. I can’t seem to figure out how to format the date field to MMM DD YYYY and leave all the time zone stuff off. Any advice?

1 Like