Can you use Subtables with Existing database?

Actually you are correct, the last table is MEDIA in green! I didn’t seen.
But on the App side it doesn’t appear to select for the 2nd repeat.
SO, do I select the MEDIA table in the Query Builder? or not

You can select media and it will return the images as an array or if you join them it will also add the parents fields to every repeat I’ll try find where hyperbytes explained the data output

Here’s the explanation

Okay, Media is now coming up on the app page to select… but its still not displaying the data

Have you tried double clicking it in the query builder it opens a new panel for that table

You click where it adds the fields your outputting not where it lists all the fields in the table on the left just to specify

double clicking doesn’t work it just adds it to the columns.

You need to click to the right where it adds it double click what it adds

oh yes! that worked! when I double click it opens another window. I added the fields I need. Do I need to set a condition or it should be okay because it has a foreign key already

This condition would be if you only wanted certain media for example say you have a media type field and only want png you’d need to condition if you want all from that project you won’t need a condition most likely depends on the data really

Okay. Something is not right, on the App, the Media doesn’t appear under the main query. In appears int he Serverconenct but nor in the parent nest. So I can’t select it like you had in your code.

Maybe check this out for how to use the data

I will try to start again. I will let you know how I go. Thanks for trying to help. Its frustrating not getting nested repeats happening. I don’t mind which way I do it. Its doesn’t have to be Subtables, happy to use normal joins. … I just want it to work.

Okay the App side it giving me the options to select… But the query doesn’t display the Media data. its blank. The main table data appears fine. but not the subtable media

If you create a new API and add main projects table, does it show media as a subtable in orange in the Query Builder?

It displays media, but not in orange. It display in normal green.

When you double clicked did you add fields you needed like you do with other queries? Also what does the binds look like for the media is there a chance you selected it from somewhere other than the repeat

Have you also tried inspecting what the query returns in browser tools under network XHR it will show the action (might need a page refresh once in browser tools)

The issue is with the query side/subtable - the app side binds are okay.
So when I test the query, Projects display correctly but Media is empty - I tested this in Network XHR - this is how I know the server side is the issue.

Could you try a new query with just projects and media as nested and see what happens it could be how something is setup in the query

Okay. I got it to wor! Yay. Finally - but not with subtables - I gave up on subtables! I just used the tutorial below again (I had the output selected for one part that I shouldn’t). Thanks very much for your help.

Its great to finally see nested repeats :slight_smile: Thanks very much guys - @guptast and @Sorry_Duh :slight_smile:

……
For the benefit of others :blush:….

I followed the tutorial below.

With respect to Subtables I am not sure why it didn’t work? Even though I could see the ‘subtable’ showing in ‘Query Builder’. (by the way the subtable wasn’t originally showing in Query Builder, even though I have the foreign key setup correctly in MySQL, likely because the Database schema wasn’t refreshed as @George mentioned in his reply further above, but it appeared later on - I think after I did the refresh).

When I tested the query in ‘Query Builder’ the output didn’t show the subtable records, hence the nested repeat on the app side wasn’t working. I tried a few times and ensure the query were correct and couldn’t get it to work.

Regardless I achieved the same results using the nested repeat in Server App using the tutorial mentioned above.

2 Likes

You’re welcome! I’m glad that it’s working as needed :slight_smile:

1 Like