Query and SQL select fields

Enonic version: 6.14

Hi there, I’ve searched on forum if it is possible to do fields selection (at least get the main fields like id, path and displayName). I found this topic Content query map (SQL select fields) and it is closed. Though I couldn’t figure out if the feature is implemented or in ‘plans for future’?

And if it is not implemented, is there a way to (at least!) exclude data field?

Thanks in advance!

Hi Nat,

This is still in the backlog, and have been moved aside for other more important features.

A way to do this today would perhaps be to use a .map on the result you get back in JavaScript and manually remove the data-node. That would clean the data up before sending it further down your app.


Okay, thank you! This is what I use right away :slight_smile:

Just curious about your use-case here?

Normally, the fact that you get many fields in your object is not a problem and inexpensive in XP as these data are available locally, and you would normally build a model and pass it on to your templates as required.

What is your use-case?

My use-case was to get list of friends and make a menu in right column. So, the list needed only 2 params ‘path’ and ‘displayName’. I would normally do in mysql select id, path from .... The list is really short and neat.

To clear the picture, each friend (a profile object) has really big amount of data.attributes (over 30). So, I thought there’s a way to avoid the bunch of information and get only selected items as well.

Short answer here is that you don’t need to worry about receiving these additional fields when using XP. It does not work like a traditional SQL database…

However, there is a performance boost to be gained by building a custom model of exactly the data you need before passing it to your view… This is simply MVC best practice anyway :slight_smile:

1 Like

Heh, yes, mvc that’s what I’m used to when I work with django. I’d say I need to get used to XP best practices :slight_smile: