How to display records from one query in separate responsive tables

Hello,

I have a query that generates this result in first image. I would like to display Candidate Name, Party, Result in separate responsive tables like shown in the second image with each table only showing records of one constituency. I know I can do this by generating separate queries for each constituency but I also know this can be done from this same result set. Hoping someone can show me the steps or guide me .

RESULTS
QUERY

My Goal.

1 Like

Hello, what’s the logic you are using to differentiate the results? How can you tell which record to go in which table?

Constituency.
The column 2 in the result image. I’d like Each responsive table to display records of one constituency.

SELECT CANDIDATE_NAME, CONSTITUENCY, PARTY, RESULT	
FROM tableName
WHERE ELEC_YEAR = 2020 
AND REGION = 'regionName'

I have SELECT DROP DOWN which the user can select the region and year.

You can then use the group by filter on the front end to do this if you want to use one query.
Or better check:

And use nested repeats for this.

Where do I locate the group by filter?

Better check the tutorial I sent you. Will be better for your case.

I expect @Teodor has already given you the best solution. However, another approach which can be useful sometimes, and which only requires a single query instead of multiple queries, is to use the ‘where’ formatter, something like:
serverconnect.data.qry.where(constituency, constituency_id, "==")

Eg I had a page displaying a number of swiper components using the same data source (but with different categories). I couldn’t use a nested repeat because the swipers were in different places on the page - with different sections between some of them - so I used expressions like the one above for the various swiper data sources.

1 Like

@Teodor following the nested queries tutorial this is the output I am getting. I am not sure why just one value is repeating through for each constituency instead of all the enteries. Please please guide me

You are using wrong binding/expression somewhere probably.

I restarted the entire thing. Please see the screen shot attached. I’ve gotten to the part where I have to add the table rows containing the data from the query. In your case you added just a paragraph but in my case I want to add a table. So I right Click repeat2 and go to Generators – > Boostrap Table Generator and select Query2 as the expression my page freezes. Any Idea why?