Fabrizio
Fabrizio

Reputation: 8043

TField's Origin property meaning

I have a doubt about the TField's Origin property.

The documentation states:

Origin is only assigned at design time by the Fields editor, and only when the field component is used by a TQuery object. The Origin property distinguishes the name of the field as it appears in its dataset from the name of the field in the base table on which it is based. For example, in a query that uses the following SQL statement, the value of Origin is CUSTOMER.CUSTNO.

SELECT CUSTNO AS ID FROM CUSTOMER

In this case, the FieldName property is ID.

Note: Origin is not available on Linux. The Origin property is only implemented for BDE-enabled > datasets, which appear only in the Windows product.

But what if the SQL text contains table aliases?

SELECT C.CUSTNO AS ID FROM CUSTOMER C

Should I expect Origin value to be CUSTOMER.CUSTNO or should it be C.CUSTNO?

Background explanation:

I am using a DevExpress TcxDBFilterControl which uses the field's Origin property (in the TcxDBFilterControl.GetExpressionFieldName, i.e. if Origin <> '') instead of the FieldName property, for composing an SQL condition text. The TpFIBDataSet sets Origin to CUSTOMER.CUSTNO instead of C.CUSTNO, so I am wondering if it is a TpFIBDataSet problem (which should have set Origin to C.CUSTNO) or if it is a TcxDBFilterControl problem (which is not considering that one might have aliases in the SQL text).

Upvotes: 3

Views: 498

Answers (0)

Related Questions