Problems with TField.Origin property
Problems with TField.Origin property
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
			
									
									
						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
Try specifying field names manually. For example:
  This helps to avoid collisions with field names.
			
									
									
						Code: Select all
SELECT Table1.Field1 as T1F1, Table2.Field1 as T2F1 ...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 ?
			
									
									
						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 ?
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 .....> 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.
			
									
									
						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.
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- 
				a.alekizoglou
 - Posts: 32
 - Joined: Fri 22 Sep 2006 08:32
 
Any news on this?
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
			
									
									
						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
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:
			
									
									
						> 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';