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).

4 Related questions 2 How to extend a TFieldDef in easy and safe way? 0 Delphi 7 - which unit declares TProperty? 4 Is it possible to tweak TStringField to work like TWideStringField in Delphi? Related questions 2 How to extend a TFieldDef in easy and safe way? 0 Delphi 7 - which unit declares TProperty? 4 Is it possible to tweak TStringField to work like TWideStringField in Delphi? 1 TColumn.FieldName property editor 2 RTTI GetFields and GetAttributes on TForm 1 Why the "T" prefix in TObject? 1 Overriding AsString in TFields and TStringField 1 How to check that a TField has been modified manually 2 Why TForm.Handle is a getter instead of a field? 1 Delphi component design, add a field in TFieldDataLink Load 7 more related questions Show fewer related questions Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like