520
Views
6
Comments
Solved
Custom table records: aggregation and table display
Question

Hi everyone,


I would like to generate a table records like this (see attachment) ...


2 tables: CITIES / COUNTRIES


I know the country of every city ...


Can I display the table records in this way ?



Thanks !


LUCA

aggregate.PNG

mvp_badge
MVP
Rank: #2
Solution

Hi Luca,

If you have only a limited number of countries and cities, you could have on the main Screen a query that retrieves all countries and put that in a Table Records, and in the second column put a Web Block that receives the Id of the country (or whatever identifier you have for country in your cities Entity) and contains a Table Records displaying only the cities for its input parameter country. However, if you have a large number of countries or cities, this will be slow (since each country Table Row will execute a query as part of the Web Block).

Another option would be to query on the main Screen all cities with their country, and only display the country name the first time (by using an expression with direct indexing on the List, checking if the previous is the same, and in that case not displaying it). It will take some styling to get it vertically centered like that though, and perhaps a ROWSPAN extended attribute to span rows.

Rank: #4139

Thanks Kilian, I think I'll adopt your first solution ...


I'm gonna try it !


Thanks !

mvp_badge
MVP
Rank: #2

You're most welcome! Happy coding :)

Rank: #33671

Hi everyone, 

Is it possible to have an example of these solutions? 

thanks