Nested Paged Query with Table Generator?

3

Server Connect:
4

< div id=“repeat1” is=“dmx-repeat” dmx-bind:repeat=“AllCurrentSupportTickets.data.RepeatTicketUIDs”>
< p >{{extRef}}</ p>

This works.

Dave can you try explaining your issue from the beginning as I don’t understand what’s wrong exactly…
Also - what the output option in Server Connect does is to output the results on the page. It does not stop items from being repeated.

I have two tables on two connections.

Connection 1 looks up the user and relates them to entries via session from table 1. Output is unchecked.

I add a Repeat using this outputs results.

I then add Connection 2 and query table 2 using the result from the first query. This output is checked.

This is the output I wish to repeat.

But Dave, how should this nested repeat be displayed on the page? Just it on the page, without being wrapped with it’s parent repeat? How many results does the parent repeat return?
Of course it will only return the first result of the parent repeat if you only use the nested repeat without the parent one wrapping it.

Have you checked this tutorial: Nested Repeat Regions ?
It explains exactly how to use nested repeats - make sure to just follow it exactly.

I’m going about this the wrong way most definitely.

I’m not sure it’s nested queries I need.

I need to take the output from Query 1 and use it to populate query 2 to use as a repeat. That’s the basic synopsis… It’s across two connections and two tables. Is this possible? My wife is looking at me with that ‘wife look’, as wives do… :wink:

Then it’s not nested queries what you need.
Steps should be:

  • query 1
  • repeat (query 1)
    • setvalue step (here add the query value you need)
  • query 2 (filter it with the setvalue step value)

Dave.Bit confused but are you saying you want to select a single value from table 1 then select multiple child records from table 2 where there are linked via a key from table 1?

Hi Brian,
Yes from table 1.

Thanks Teodor will give that a try.

OK, can I use a a simple example then to help me understand

Say you have events in table 1 with primary keys

and bookings in table 2 referenced with the event Id’s as foreign keys

So you want to select the event from table 1, get its primary key and then select all entries from table 2 with that key?

Exactly, throw in two DB connections as one table is on Connection 1 and the other on Connection 2.

Really appreciate both yours and Teodors time, especially on a Sunday evening!!

I’m sure I’m being totally stupid here and am very sure I’ve done this several times before…

why two different DB connections, 2 different databases?
That is the complicating factor if so or it could be done with one simple data query

Unfortunately it’s the way it is with this Client. I may just write a trigger to replicate everything from db1 table 1 to db2 with a new table… They are both hosted on the same box… Was hoping I could do this within Wappler though.

Should be possible, just need to properly visualise what you are trying to achieve

List of Tickets on screen (jn table or similar)
Clicking ticket in table 1 returns all entries about that ticket in some sort of table secondary table 2 (or modal or whatever)

1 Like

I’m going to come back to this tomorrow but for now to get it working for Monday morning I’ve implemented a trigger on db1 to insert/update/delete entries in to db2. Then simply pull the query from db2. Dirty but gives me time to think!

I’ll outline it tomorrow Brian (properly). Really appreciate your help sir. Otherwise my missus is going to make me muck out three horses for ignoring her all evening, stuck in a loop hahaha…

:wink:

Lol, i feel your pain . do what I do, my 2 horses have a field shelter and go in and out whenever they want, open access. That way they rarely actually dirty in the stables. Havn’t mucked out in 3 years since I started doing that!

1 Like

Right got it to repeat what I wanted in the end:

Server Connect:

Repeat on the page itself:

5

The results are repeating as expected but paging simply does not work selecting the same repeat (repeat1 in this example). Obviously as there is no paging data within the repeat step despite the initial query being paged and the output query being paged.

Interesting exercise and as this post has been unlisted one only those that have responded to will get to see. I’ve since had permission to re-structure the databases as I see fit so have lessened the complications considerably so the above is not really required, but still as I mentioned, an interesting exercise in perseverance none the less. Although I did not get the paging to work I can settle my mind now… Well kind of, you know the apple! Bit of London slang there, apple-core (score) :wink:

Thanks all! Just wanted to update this post and shine a light on what was done to achieve a semi-pleasing outcome.

:smiley: