Hi @cpuser,
Yes, the subtables will appear in the query builder if you have set up a foreign key between two tables.
The only difference between two tables - main & subtable setup with a foreign key - using naming convention with prefixes and without prefixes is how these are displayed in the Database manager. If the tables have the same / matching prefixes, then these will appear in the Main -> Subtable hierarchy in the database manager, otherwise these will appear as two Main tables. See the screen shot below showing the main -> subtable hierarchy with user_id as a Reference field.
When using the main / subtable structure in the Query Builder, there’s no need to add another step to run nested repeats anymore if using main / subtable structure with FK. As both tables will appear in the same query, you can use fields from both tables on the client side. See an example below with a Repeat on Main table query and AC component Form Repeat
to access fields from the subtable details
.
<div dmx-repeat:repeat1="sc_clients_list.data.q_clients_list">
Client: {{email}}
<div is="dmx-form-repeat" id="formRepeat1" dmx-bind:items="details">
Name: {{details[0].first_name}} {{details[0].last_name}}
</div>
</div>