Problem with query visualization

Hi everybody, I made a complex custom query that uses another custom query repeat as a filter.
First query: I read a value ‘codcatmer’ from a table. (Every user can have one or more ‘codcatmer’ associated with his user code). In this case results are ‘XXX’ and ‘YYY’

Second query: In the next step I use ‘XXX’ and ‘YYY’ for read values from another table, filtering rows who have ‘codcatmer’ with that values

It seems working: if I do the preview in the browser, I see the correct values.
In red the values i’m searching (‘XXX’ and ‘YYY’)

Now that’s the problem:
if I try to put the data in an automatically generated table, I only see the records related to the first value. (I see only rows with ‘XXX’ and not ‘YYY’)

table-pre1

table-pre2

What am I doing wrong ???

Your server connect is returning an array (a list of things) called catmer. And for each iteration of that array, you have another array dati_mgana.

So in selecting dati_mgana in your data_view1, you are actually selecting dati_mgana for the first iteration of catmer only (hence why you are getting the XXX values.)

If you want to match that output, you would have a repeat of catmer on the front end, and then another repeat inside that using dati_mgana. Or maybe you want to rethink your queries so that you return everything in a single array, instead of nested. Just depends on what you are really going for.

As @mebeingken already mentions, you are probably only showing the first recordset of the repeat. To show all content you could use 2 repeaters.

Your query is not that complex and you could probably put it in a single query instead, that would also improve in performance.

In the second query replace the last condition mgana.catmer LIKE :p4 with mgana.catmer IN (SELECT codcatmer FROM utenti LEFT JOIN catmerrel ON catmerrel.codutente = utenti.codag WHERE codag = :p4). The parameter :p4 is then the parameter you’ve defined in the first query.

I have to do more accurate tests about that query you proposed, but at the first look it seems to work property!
You’re the best @patrick !