salk31 / RedQueryBuilder

SQL Query Builder UI JavaScript component
http://redquerybuilder.appspot.com/
Eclipse Public License 1.0
96 stars 22 forks source link

Option to use labels as names for sql select fields #29

Open sgunnzero opened 10 years ago

sgunnzero commented 10 years ago

Have just started using RedQueryBuilder, quite impressed. The form I'm using it in returns a table of results. I'd really like the column names to be the labels supplied, rather than the database field names. This could be accomplished by adding an AS clause to the select fields - e.g.

SELECT x0.db_column_name AS MyLabel

I'm going to manually add them to the sql in onSqlChange, but it would be nice if it was automated.

Thanks, Stuart

salk31 commented 10 years ago

Hello,

Are you using the JS version? For better or worse it is sort of hardwired in there.

At some point I'd like to support self joins, would you have any preference on what labels might be used then?

sgunnzero commented 10 years ago

Hi,

Yes, the JS version. No opinion on self joins. I ended up storing the sql twice - one in a basic form that redquerybuilder could load, and one in a converted form including AS fields and some extra joins.

Thanks, Stuart

salk31 commented 10 years ago

OK. I think I'll cast this as a feature request to have proper control over the "SELECT" part of the query, generally RQB doesn't do much in this area. Is for the developer.

Please scream if that is an abuse of this ticket.