Linking or daisy chain different tables onto one page

Hi all,

Still learning here and just wondered if you could point me in the right direction. This is a backend query in relation to Database in MySQL.

So, I have the following tables all in the same database.

  • Table A
    Name
    ID

  • Table B
    Field 1
    Role
    ID

  • Table C
    Field 1
    Field 2 etc
    Role

So what I’m trying to achieve is when you search for Name in Table A (a contain) you can click on the ID. The ID will then show on the same page Table B, with the linked ID and also Table C with the linked Role.

I’m effectively wanting to show related info in 3 tables on the same page.

I’ve achieved the first step in Tabel A and the search. I’m just unsure how I now add the other two elements to the page?

Any tips or links, please
Thanks

If i follow what you want correctly you will need 3 queries, say conn_A, conn_B and conn_C, one for each table based on the ID and 3 bootstrap tables and 3 variables varA (set to 1), VarB , varC (set to 0) to control the table display

For table 1 the query executes on page load, the other two are set to No Auto,Load

Regarding the tables you need to hide the tables 1, 2 and 3 (2 and 3 initially will be hidden as variable is set to 0). use the conditions dmx-show=“varA == 1”, dmx-show=“varB == 1” and dmx-show=“varC == 1”
Use the generator to create a bootstrap table based on the 3 queries in order

This will mean that table one will be displayed but table 2 and 3 will be hidden (as value is 0)

Now when clicking on the ID in table 1 from the dynamic event mouse click set varB to 1 to reveal the table and perform a load() of tableB with conn_B.load() to get the content. You can also hide the previous table if you wish by setting the variable to 0

The repeat the same for table C, setting varC to 1 and doing a conn_C load()

As an aside rather than using dmx-show() you could also use conditional regions using the same logic method

1 Like

@Hyperbytes Thanks Brian, I’ll give that a go. Have you done a Video on something similar that I can watch? Cheers M.

Sorry no video but if you get really stuck I could probably knock up a rough and ready one.

Thanks so much! - Let me try and figure it out and have a go… I’ll come back if I get stuck! :see_no_evil:

Hi there, (@Hyperbytes)

I’n getting stuck on this one… Its mainly I’m unsure where the actions go and I’m struggling to add three fields (seems to not show even after I update the Database structure)

Are you able to throw together a rough a dirty video? (nothing fancy) I’m sure others will benefit from this?

Cheers
M

Hello - I’ve tried this suggestion but this is not quite what I am looking for…

I’ve got three tables. A, B & C. All tables will be visible on a single page. When the user searches for a record a elastic search list is produced under the search bar. When elected table A is the main record, table B is a linked record of A (using the same keys) and table C is a linked record of table B (using the key shared with the B & C)

Does that make sense? A is filtered on the search, B is filtered on the Key of A, and C is filtered on the Key of B… So do I just need to setup the queries or filter at the front end?

Cheers
M

Is this what I need to be looking at - https://docs.wappler.io/t/creating-database-relations-with-the-database-manager/20653

I’m getting a bit lost so any direction would be really appreciated.

M

Think I’ve got what I’m looking for over at https://www.youtube.com/watch?v=8pAh9KBUiyw&t=302s

Sorry for, not getting back to you, got a nasty dose of COVID, just getting better now

1 Like

Sorry to hear you have not been well, hope you make a safe recovery soon :slight_smile: