NonQualifiedNameNames in v3.1.1.1024
Hi,
I have a known column name, and want to find the object in the query that corresponds to that name. The name I have is not qualified but it is qualified in the sql. E.g. I have "Color" and the column in the select is "Product.Color"
I have the QueryColumnListItem-s from the select query, and want to get the unqualified name. In the past I used
CriteriaItem crit = ...
(crit.Expression as SQLExpressionColumn)?.Column?.NonQualifiedNameNames
In v3 I have
QueryColumnListItem crit = ...
//NonQualifiedNameNames doesn't exist, not sure how to use
//(crit.Expression as SQLExpressionColumn).Column.BuildNonQualifiedNameNames
//so instead...
SQLObjectColumn col = (crit.Expression as SQLExpressionColumn)?.Column;
var foo = col?.Items?.FirstOrDefault() as AstToken;
foo?.Token //contains "Color"
I worry this is a bit of a hack and won't work in some circumstances, is there a better way?
Addendum: You should search for column name in the StatisticsOutputColumn.ColumnName (or FieldName).
Again, I don't understand your task in detail. May be it is better for your task to search in the UnionSubQuery.QueryColumnsList as you did that before... I don't know.