Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow disabling the auto group_concat behaviour on list column select properties for multi relations #5461

Closed
LukeTowers opened this issue Jan 15, 2021 · 5 comments

Comments

@LukeTowers
Copy link
Contributor

In https://github.com/octobercms/october/blob/develop/modules/backend/widgets/Lists.php#L502-L504 the select property of a column that references a relation with multiple associated record is automatically wrapped in a group_concat() call to automatically concatenate all of the results of the select query into a comma separated string.

This is fine behaviour by default, but a problem arises when attempting to use a DB engine that doesn't support group_concat (i.e. Postgres or SQL Server) or when attempting to do more complex select queries, such as summing a column on all the related records.

A new property, selectAutoConcat(open to suggestions for better names) should so that the current behaviour can be disabled by the developer when they want to handle those more advanced use cases.

@LukeTowers LukeTowers added this to the v1.1.2 milestone Jan 15, 2021
@Rike-cz
Copy link
Contributor

Rike-cz commented Jan 16, 2021

@LukeTowers What about sorting inside group_concat? #5424

@LukeTowers
Copy link
Contributor Author

Hmm, I would probably say that once this is implemented #5424 would become unnecessary since you could just write out that SQL yourself. Seems like it might be a bit too magical to implement #5424. @bennothommo any thoughts?

@Rike-cz
Copy link
Contributor

Rike-cz commented Jan 17, 2021

If you think using ORDER inside GROUP_CONCAT(), it's standard I think. But @bennothommo can have different opinion.

@daftspunk
Copy link
Member

For complex scenarios like this, it should be handled by a custom column select using the list extension feature. It's basically the same thing and select acts as a defacto helper for this

@Rike-cz
Copy link
Contributor

Rike-cz commented Mar 10, 2021

@daftspunk It could, but I think some ordering inside October's native group_concat feature is required. Now it shows items in random order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants