Page 1 of 1

Problems with TField.Origin property

Posted: Fri 24 Mar 2006 13:21
by ziclope
Hello,

I have a SQL with various joins. The problem is when 2 tables have fields with the same name. This property doesn´t show the correct name. Example for Field Status:

When Open the query all fields are filled

Field.Origin = TableA.Status
Field.Origin = TableB.Status_1

but Status_1 doesn´t exists

Regards

Posted: Fri 24 Mar 2006 14:25
by Antaeus
Try specifying field names manually. For example:

Code: Select all

SELECT Table1.Field1 as T1F1, Table2.Field1 as T2F1 ...
This helps to avoid collisions with field names.

Posted: Fri 24 Mar 2006 15:08
by ziclope
The problem is that I need The composed field in origin
for recreate the SQL query.

for example:

SELECT * FROM articulos, articulos_details where
articulos.Field = 1 and articulos_details.Field = 1

The problem is in generated fields:

articulos.Field
articulos_details.Field_1 <- This is the problem !!!

Do you understand me ?

Posted: Fri 24 Mar 2006 22:59
by GEswin
In this case you need to write your own SQLUpdate sentence, or specify the fields in the select

Code: Select all

SELECT a.field as Field,b.field as Field2, ... FROM articulos a, articulos_details b .....

Posted: Sat 25 Mar 2006 12:38
by ziclope
You don´t understand me

I use Origin for create an automatic complex query.
I don´t need a SQLUpdate...

Posted: Mon 27 Mar 2006 08:57
by Ikar
We will think about changing this behavior in next MyDAC version.

Posted: Mon 27 Mar 2006 10:17
by ziclope
this behavior ? for do ?
Exists any date for new release of MyDAC ?

Changing to my question...
How could I know all real fields for queries with joins ?
I need decode all field in result. For example:

Field1 = Table1.Name,
Field2 = Table2.Name,
Field3 = Table1.Date,
....

Regards

Posted: Tue 28 Mar 2006 08:38
by Ikar
> this behavior ? for do ?

I mean method to set values for Fields.Origin. Changing this method can cause problems for other MyDAC users who use old behavior.

> Exists any date for new release of MyDAC ?

We can't specify any terms.

> How could I know all real fields for queries with joins ?

As temporary solution you can try to remove '_' from Origin.

Posted: Fri 01 Sep 2006 06:49
by ziclope
Any changes with TField.Origin behavior ?

With ADOExpress you fill in manually this property. Is the best solution because in complex query.

Regards

Posted: Fri 01 Sep 2006 08:40
by Antaeus
In the next version of MyDAC we will add a new option that will enable/disable automatic generating of fields origin. And the behavior itself will be changed as well. For example, both Table1 and Table2 have field named `uid`:

Code: Select all

Old generated origins:      New generated origins:
    Table1.uid                  Table1.uid
    Table2.uid_1                Table2.uid

Any news on this?

Posted: Tue 03 Oct 2006 14:54
by a.alekizoglou
I have the same problem and waiting for the new build. I saw there is a new version out but did not find any solution to this problem.

Ikar, in a previous post you said as a temporary solution remove _(name). What is that, how can we remove something from .Origin since this is a readonly property?

Regards,

Athanasios Alekizoglou

Posted: Wed 04 Oct 2006 09:00
by Antaeus
The option mentioned in my previous post will be added in the next version of MyDAC (MyDAC 5) but not in the next build. That's why you have not found solution in the last build of MyDAC. As a rule we do not change public interface in builds, all changes in the interface are applied to new version of MyDAC.

> Ikar, in a previous post you said as a temporary solution remove _(name). What is
> that, how can we remove something from .Origin since this is a readonly property?
You can assign value of Origin property using for example following code:

Code: Select all

  MyQuery.Fields[0].Origin := 'correct_field_origin';