Querybuilder Alias Name for fields

The case SVY-2323 ist difined as fixed in Version 6.1.5 / 7.1.
I can never find an explanation how to use the new feature.
Does anyone know, how to define a alias name with QueryBuilder?

Hi Gabriel,

You can add a column alias name by passing an optional alias argument to the query.results.add() methods.

Please see below for example :

 	query.result.addPk()
			.add(query.columns.firstColumn, 'aliasForFirstColumn');

Hope this will help!

Thanks

Unfortunately, the alias is returned as a lowercase string. So when using

query.result.add(query.columns.firstColumn, 'aliasForFirstColumn');

For loading a JSDataSet, the columnname will be ‘aliasforfirstcolumn’. I suspect it is postgres returning it like that, because ‘SELECT first_column AS aliasForFirstColumn’ will also return an all lowercase alias.
This can be avoided using double quotes in plain SQL, so ‘SELECT first_colum AS “aliasForFirstColumn”’ will give the camelCase alias name.

However, using ```
query.result.add(query.columns.firstColumn, ‘“aliasForFirstColumn”’);


Anyone know how to do it right?