In advanced query being able to set an alias to the output structure

By Diogo Cordeiro on 27 May 2010
When we have the need to invoke the same entity twice in advanced queries we have the absolute need to put an alias in one of them, to distinguish them.

The thing is that service studio puts a warning to it if you use Alias.* ...

Perhaps one could assign an alias to the output structure?
Ricardo Ardito22 Oct 2010
There are some queries where we need to reference the same entity more than once (for example, entity "person" could be referenced twice, with diferent "roles": CLIENT and SUPPLIER).

In this situation, the second reference currently get named "person_2", and it makes confusing to use its columns outside the query editor.

So, it would be nice to be able to somehow "rename" the entity in the query editor, in such a way that we could reference it like "client.name" or "supplier.name" outside the query.

(In SQL we would do it in the FROM clause, like: select ... from person client, person supplier ...).

Merged from 'Set entity "ALIAS" in queries' (idea created on 2010-10-22 22:09:26 by Ricardo Ardito), on 2011-03-26 16:24:25 by Rodrigo Castelo
J.25 Oct 2010
absolutely!

Merged from 'Set entity "ALIAS" in queries' (idea created on 2010-10-22 22:09:26 by Ricardo Ardito), on 2011-03-26 16:24:25 by Rodrigo Castelo
Pedro Ávila26 Oct 2010
A must have! It would improve readability and "code" auto-documentation.

Merged from 'Set entity "ALIAS" in queries' (idea created on 2010-10-22 22:09:26 by Ricardo Ardito), on 2011-03-26 16:24:25 by Rodrigo Castelo
Tom Hubbard10 Dec 2010
This would help a great deal.

Merged from 'Set entity "ALIAS" in queries' (idea created on 2010-10-22 22:09:26 by Ricardo Ardito), on 2011-03-26 16:24:25 by Rodrigo Castelo
ovatsus23 May 2010
So instead of using Employee_2, Employee_3, etc.. we can use more meaningfull names like Referal, Manager, etc...

Merged from 'Allow to name repeated Query Entities' (idea created on 2010-05-23 23:45:11 by Gustavo Guerra), on 2011-03-26 16:56:40 by Rodrigo Castelo
Henrique Matos14 Apr 2011
It would be nice to set an alias for an entity in a simple query, as it might be confusing when you use the same entity twice (or more) in the same query (e.g., ENTITY and ENTITY_2 are not easily sorted, everytime you need to know which is which).

Merged from 'Set aliases for entities in simple queries' (idea created on 2011-04-14 12:13:12 by Henrique Matos), on 2011-04-20 09:44:30 by Rodrigo Castelo
Kilian Hekhuis25 May 2011
Seconded for the last remark about simple queries, as it goes for them as well.
Diogo Cordeiro27 Aug 2011
More than an year later : 

It would also be great if Service Studio would validate and even auto-complete attributes that come from aliases in advanced queries. Mispells happen all the time (yeah yeah conscience grammar guy : try to hit 20 keys per second and then tell me if only illiterate do it).
Davide Marquês23 Oct 2012
+1!

This would be a big improvement in that it would make the code using the resulting structures more readable and enable changing the advanced query with less outside impact.
João Melo9 May 2014
Voted!!!
Goncalo Borrega23 Sep 2014
I'm happy to let you know that with OutSystems Platform 9 you can change the name of the output structures in an advanced query.
Enjoy


Carlos Freitas31 Aug 2011

When we add the same table more than one time to the output, it would be helpful to be able to rename the output.

For example, if we have a table with to foreign keys named CreatedBy and  UpdatedBy from the User Table, when getting the values we would have User and User_2, which is not very intuitive and easy to use.

Merged from 'Alias in the query output' (idea created on 2011-08-31 19:21:37 by Carlos Freitas), on 2014-09-23 23:39:38 by Gonçalo Borrêga
Kilian Hekhuis8 Sep 2011
This is a duplicate.

Merged from 'Alias in the query output' (idea created on 2011-08-31 19:21:37 by Carlos Freitas), on 2014-09-23 23:39:38 by Gonçalo Borrêga
Henrique Matos24 Sep 2014
Haven't had the chance to peek into Platform 9; is this extended to Simple Queries as well?
Matthias Preuter24 Sep 2014
Yes it is extended in the Simple Queries too!


J.26 Sep 2014
Yay!