Issue with nested repeat regions

I have been struggling to get the nest repeat region to display the data that i want correctly for several days. Just when i think i have it correct, it just doesn’t display what i want.

Here is a basic structure of my querys

Query 1 - gets patient ID number
Repeat Region 1 - Runs through Query 1 to get the names
Query 2 - Within the repeat region of this i am going and finding out specific dates that this patient was seen through a query
Repeat Region 2 - loops through the Query 2 to show all of the dates

Results should look like this

Patient Name
** Date**
** Date**
** Date**

However, i am not able to get the system to loop through the dates. The patient name shows correctly, but the dates are only showing the very first record date and no others (see screenshot)

From the screenshot you can see that i see the data in the results section (highlighted) but no matter what repeat region i setup on the App side, it doesn’t show this data

can you please help me and tell me what i am going wrong

You don’t need this repeat 2 in your server action and the expression selected on your page are wrong. You should not have expressions with [0]

There’s a tutorial explaining how to do this:

As explained in the tutorial you only need:

- query1
- repeat (query1)
-- query2 (filtered by a value from repeat)

Follow the tutorial please and make sure you are selecting the proper expressions on your page.

Okay, i understand that and was able to get the repeat (query1) and the Query 2 to display

now, i have a repeat (query2) that i need to run which will get an date of a record and display the details.

…query 2 - gets the records for the particular patient from (query1)
…repeat query 2 - will get all of the details of the record ( multiple lines in mysql)

How can i get this to display? I have currently it setup like this

can you have a double nested data display? It should be running through the query 2 data.
Does that make sense?

So when i setup the Row repeat, i selected this expression

when i select the data to display on the webpage, i am choosing this from the data bindings

and this is the result i am getting…as you can see the numbers are repeating on each of the rows

sorry, it is just a little frustrating when something that is a simple coding procedure is taking so much time to get the same results in Wappler for the repeat feature. It is not producing the results that i expect and i am having the hardest time to get this working correctly.

Here is a visual of what i am trying to complete

Green Row is the first repeat query getting the patient data
Yellow Row is the query getting the specific dates for that patient that they were seen
LIght Grey is the details of the treatment and what they had done on each specific visit

I hope this helps clear up what i am trying to accomplish and allow you to assist me on what i am doing wrong.

Well, it is actually simple with Wappler, as the tutorial i sent you shows. It’s nothing too complicated when you have the right logic and know what you want to do with your data and how do you want to present it on the page.

You are binding a single record inside each of your dates.
You need to repeat the query data about the details per date so you need to create a repeat region on your page from the treatment details query, nested in each date.

so are you saying that for the details of each of the dates, i do not create a repeat region on the server side, but on the page side?

I did follow your tutorial to a T that you sent me…and that worked to get the specific Patient Names and the Dates of treatment that coorespond for them. However, now i need to have an additional nested repeat region under each of the Dates of treatment to get all of the actual treatments for that date.

Do i create the repeat on the server side like i have or just do this on the page side? That is where i am confused.

As i explained in my last post:

i.e. on the page … you don’t need a repeater on the serverside as you already have your query and you filter it there.

okay, maybe that is where i am having the issue. I am trying to create the repeat query on the server side.

I will try that Teodor and get back to you. Thank you for your help

You need a repeat on the server side only when you need to nest a query inside it.
In your case your query is already nested in a repeat and you don’t need to nest more queries. So use it directly to create a repeat region on the page.

okay, i did what you told me…and the repeat function for the treatment details is showing the same treatment and ID# for each of the dates and patients. So it is not repeating but looks to only be taking the first record in the query.

How can i get the query to loop through a sub-query to get all of the treatments that were applied on the date that is shown in the query?

-Patient Info #1
----Date of Treatment
------Need a query to repeat here based on the ID of the Patient and the Date of the Treatment to get all treatments

-Patient Info #2
—Date of Treatment
------again need query to run again to loop through treatments

You need a repeat step in the server action which repeats the date query … then nest the details query inside it and filter it by the date returned.

You already had this in your previous screenshot and now i see you removed it:

So …

[query get_treatment]
[repeat query get_treatment]
  [query get_patient_info]
  [query get_treatment_date]
    [repeat query get_treatment_date]
      [query get_treatment_details]

yes perfectly.

So when i setup the Repeat on the page, which expression should i be choosing for that last query?

I checked the Inspect page and they are there. The highlighted blue fields is what i want to show under each date

I am choosing this one

and chosing this as my on-page data

but it does not display for me

Inside your date repeat, create a new repeat using the get_treatment_details query, which you filtered in your server action:

That’s really easy if you just follow the logic of what you need.

i did that…i still can’t get the information to display on the page itself even though i know its there.

Expression chosen

data chosen to display on page from within the repeat

Does not display on the page even though it is there - see the highlighted field in the Inspect

Can you send a link to your page, where i can inspect what’s going on?

Your date expression is wrong. It is now:

 <div class="row" is="dmx-repeat" id="repeat_treatment_date" dmx-bind:repeat="get_treatment_date">

But it should be:

<div class="row" is="dmx-repeat" id="repeat_treatment_date" dmx-bind:repeat="repeat_treatment_date">

And in your server action turn off output for this step: get_treatment_date as you don’t need its data on the front end, you are using the data from the repeat_treatment_date

Okay, that is what i thought and i TRIED to do that, but it will not allow me to select that in the expression section

i just click it and it does not populate

Please check my last post!

Your expression is wrong

It must be:

dmx-bind:repeat="repeat_treatment_date"

instead of

dmx-bind:repeat="get_treatment_date">

That’s all you need to change on your page …

shouldn’t i be able to select that using the expression picker? Without hard coding it in?

Well it is in your date picker, just select it!