ChildEntity / Lookups / FieldExpressions
Posted: Mon 14 May 2018 15:16
Howdy folks,
I'm stuck on this scenario:
I have a parent table (Customer Entity) and I have it in 1..0.1 relationships to other entities which are "drop downs" on the user interface. Such as Province and Country.
The CutomerEntity has a property ProvinceID FK and a CountryID FK; relating to the primary key of the Province and Country entities, respectively.
In my DataModule I have a TEntityTable and what I want is to have the Province.Name and Country.Name appear as a "ProvinceName" and "CountryName" field when I show it on the user interface.
When I try setting up a Lookup Field Type, I get an "Argument Out of Range" error at design time (and run time).
When I try creating FieldExpressions, I can't seem to find the right syntax to reference the child properties to expose that "Name" property of the child entity.
I also tried to make a TEntityQuery which references the Names of the child entities successfully.... but when I try to .Edit the dataset referencing the Query, it throws an exception "[TEntityQuery] None of source collection, source entity or source object is specified"
The EntityDAC Demos aren't installed with my Pro edition installation (unless I just can't find them anywhere)?
Does anyone have any code samples on how to get a Lookup to a child entity to work, or what the proper syntax for the FieldExpressions looks like, or how to properly make an editable TEntityQuery with child entity relationships, or a better overall approach to this?
Many thanks!
Tim
I'm stuck on this scenario:
I have a parent table (Customer Entity) and I have it in 1..0.1 relationships to other entities which are "drop downs" on the user interface. Such as Province and Country.
The CutomerEntity has a property ProvinceID FK and a CountryID FK; relating to the primary key of the Province and Country entities, respectively.
In my DataModule I have a TEntityTable and what I want is to have the Province.Name and Country.Name appear as a "ProvinceName" and "CountryName" field when I show it on the user interface.
When I try setting up a Lookup Field Type, I get an "Argument Out of Range" error at design time (and run time).
When I try creating FieldExpressions, I can't seem to find the right syntax to reference the child properties to expose that "Name" property of the child entity.
I also tried to make a TEntityQuery which references the Names of the child entities successfully.... but when I try to .Edit the dataset referencing the Query, it throws an exception "[TEntityQuery] None of source collection, source entity or source object is specified"
The EntityDAC Demos aren't installed with my Pro edition installation (unless I just can't find them anywhere)?
Does anyone have any code samples on how to get a Lookup to a child entity to work, or what the proper syntax for the FieldExpressions looks like, or how to properly make an editable TEntityQuery with child entity relationships, or a better overall approach to this?
Many thanks!
Tim