So, I need to create a list where the data is in two tables. Example list:
Chapter 1
Person A
Person B
Person C
Chapter 2
Person 1
Person 2
Person 3
So normally I would run a PHP database query to table one to get the list of “Chapters” and then do a while loop and hit the database table with the “Persons” in each pass of the loop.
My question is: How do I accomplish this in Wappler?
your description does not include much detail so hard to give a specific answer on the info given but you seem to be describing some sort of table intersection? if so then it can probably be done with a join. try describing what data you have and what you want to achieve rather than what you would have done previously.
you use a single query on the server side that have the id of the chapters and the persons table
then on the client side you do a group by the id of the chapters
That helped a lot however, I’m not quite there. I was able to create the Server Action and have connected it to the page. I’ve got a row with two columns and I can get the first column to show the “Chapter” names. In the second column I can get only “person” names for one of the chapters to display. I don’t think I’m using the “DIV Repeat Children” components correctly. I would like the “Chapter” names to be headers with the names listed below. Can you nest the DIV Repeat Children components?
For the first query uncheck the output option
Pass any of the values from the first query into the repeat
For the ServerConnectAction use the repeat as an expression
This way you will be able to display your data the way you want
More Progress. I now have the chapters as a heading and one person is showing up under each chapter. I appears that the list of persons is only looping once.
You need to nest a second repeat region inside the one you already have (use as expression the nested query), then bind the info inside it.
It will repeat the child elements for each parent item.