The use case is pretty simple: Events with categories
I want to output a list of the next 5 events and show the categories.
What I normally do here is getting the events in a handler, loop over the result and get the categories of each record and build my own array of structs and the loop over the array in my view.
A possibiliity to get the categories within a select would be cool.
The result could be like this:
[
{ eventID,
eventTitle,
start,
...,
categories : {
id,
label,
colour
}
},
{ eventID,
eventTitle,
start,
...,
categories : {
id,
label,
colour
}
},
.
.
.
]
the selectData could look like this:
return all m:n fields of categories
obj.selectData(
selectfields = ["eventID", "eventTitle", "start", "categories"],...)
or with only some fields of categories
:
obj.selectData(
selectfields = ["eventID", "eventTitle", "start", "categories(id,label,colour)"],...)
performance wise I think it’s not a big difference if I do the selects by my self or selectData can do this. But it could save much code if I can do this with a systemfunction already.
What do you think?