Multi Reference . Issue with displaying related data

Brian (@Hyperbytes) , I have tried everything possible and come to the conclusion that this is the most you can get

{"query":[{"name":"Wappler Quickstart","bookAuthor":[{"book_id":1,"author_id":1},{"book_id":1,"author_id":3}]},{"name":"CSS for Newbies","bookAuthor":[{"book_id":2,"author_id":2}]},{"name":"Writing Custom Formatters","bookAuthor":[]},{"name":"MtSQL Primer","bookAuthor":[]}]}

It is not not (presently) possible to get the name of the author. I have based this on the documentation:

Thanks @ben above and beyond as always
If the multi reference feature cant pull data from both sides of the reference then it is pretty much useless in my opinion.
I cant help feel this is probably a bug or an unforeseen omission of functionality, hopefully @George or @Teodor will clarify

Hi Brian, why do you have author id here in the book table?

All you need are two tables:

books
id
name

authors
id
name

And create a multi reference under books:


Then your database query looks like:

Double click the multi reference table and add a join with the authors table to get the author name:

The result is as expected:

Also seeing same thing when adding a join in a sub table element

When i add this join

i get

Yes, i’m aware thanks, that’s actually a hangover from a previous design and it is redundant at that point. I have actually deleted it since.

1 Like

Here’s my sample db and server action if you want to test:

books.zip (2.3 KB)

Inital reaction was I have WAMP still in strict mode buit checked and it isn’t

Please view this

Tried you files, that works leaving me more confused

Maybe there’s some issue with PHP then, i will test with php / mysql as well.

I am seeing an issue with aliasing, just realised this is actually on node as I switched testbeds so ignore PHP comments
Please see this video

Going to do full reinstall in case Wappler install is to blame

re-install did not make any difference

yes I have the same problem

1 Like

It does work when I follow @Teodor’s steps, thank you Teodor.

  1. Make sure to double click on the Multi Reference line

  1. In the popup, add the Authors table

Incidentally, my table structure looks like

image

identical technique on node and PHP, node works, PHP gives error

Fixed in Wappler 5.0.3

This topic was automatically closed after 32 hours. New replies are no longer allowed.