Reference index in Base: Reports

I need some help with the Reports on Base,

I’m trying to create a reference index that says which documents are related to a person. For example: John is mentioned in documents 3, 7, 8 … Jane is mentioned in documents 2, 5, 9 and so on. I’ve already created these categories and a Query in order to create the report.

I already know how to prevent a value from appearing multiple times if it is repeated (f.e. John, Jane), but I don’t know how to make that each value that is related with that repeated name (document 2, 3, 4) prints continuously in a row, instead of a column, as Base: Reports normally does.

Captura de pantalla 2023-09-20 a las 12.44.18

Thank you.

If your database (see status bar of the Base document) supports an aggregation function like LIST (Firebird) or GROUP_CONCAT (many others), this function will be your friend.
Firebird sample:
relations2listboxes.FB.odb (65.8 KB)