http://docs.transfer-orm.com/wiki/Transfer_Query_Language.cfm#Aliasing_column_names
You can create aliases in the SELECT part of the statement just like SQL. On Mon, Apr 26, 2010 at 1:48 PM, Aaron Roberson <[email protected]>wrote: > I have the following transfer config xml: > > <package name="Products"> > <object name="Product" table="product" > decorator="shared.api.datacatalog2010.model.products.product"> > <id name="id" generate="true" type="GUID" > column="productID" /> > <property name="Name" type="string" column="productName" /> > <property name="description" type="string" > column="description" /> > <property name="isActive" type="boolean" column="isActive" > /> > <property column="dateAdded" name="dateAdded" type="date"/> > > <manytoone lazy="true" name="GeographicalType"> > <link column="FK_geoTypeID" > to="Products.GeographicalType"/> > </manytoone> > </object> > <object name="GeographicalType" table="geographicalType" > decorator="shared.api.datacatalog2010.model.Lookups.GeographicalType"> > <id column="geoTypeID" generate="true" name="id" > type="numeric"/> > <property column="geoTypeParentID" name="parentID" > type="string"/> > <property column="geoTypeName" name="Name" type="string"/> > <property column="isActive" name="isActive" type="boolean"/> > <property column="dateAdded" name="dateAdded" type="date"/> > > <manytoone lazy="true" name="GeographicalType"> > <link column="geoTypeParentID" > to="Products.GeographicalType"/> > </manytoone> > </object> > </package> > > As you can see, both objects have the same property names, > "Name","ID","isActive" and "dateAdded". I do the following TQL query: > > var tql = getTransfer().createQuery(" > FROM Products.Product AS Product > JOIN Products.GeographicalType as GeoType"); > var qryRecords = getTransfer().listByQuery(tql); > > I get back a query with the following columns: > > DATEADDEDDATEADDEDDESCRIPTION IDID_1ISACTIVEISACTIVENAMENAME_1PARENTID > How do I instead get back a query with aliased columns? I would like to be > able to do something like this: > > qryRecords.Product.Name; > qryRecords.GeoType.Name; > qryRecords.Product.ID; > qryRecords.GeoType.ID; > qryRecords.Product.dateAdded; > qryRecords.GeoType.dateAdded; > > Is this possible? How am I supposed to access the columns in the query that > are duplicates? Accessing ID_1, NAME_1, etc. will not work because I > actually joining more tables and I would not know which one was which. > > Thanks, > Aaron > > -- > Before posting questions to the group please read: > > http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer > > Try out the new Transfer ORM Custom Google Search: > http://www.google.com/cse/home?cx=002375903941309441958:2s7wbd5ocb8 > > You received this message because you are subscribed to the Google Groups > "transfer-dev" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected]<transfer-dev%[email protected]> > For more options, visit this group at > http://groups.google.com/group/transfer-dev?hl=en > -- Before posting questions to the group please read: http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer Try out the new Transfer ORM Custom Google Search: http://www.google.com/cse/home?cx=002375903941309441958:2s7wbd5ocb8 You received this message because you are subscribed to the Google Groups "transfer-dev" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/transfer-dev?hl=en
