Page 1 of 1

ChildEntity / Lookups / FieldExpressions

Posted: Mon 14 May 2018 15:16
by anykey
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!


Re: ChildEntity / Lookups / FieldExpressions

Posted: Tue 15 May 2018 14:04
by MaximG
Please compose and send us a small application demonstrating the issue, as well as the model used in this project. For this, you can use the e-support form ( the "Support"\"Request Support" menu)

Re: ChildEntity / Lookups / FieldExpressions

Posted: Tue 15 May 2018 14:09
by anykey
Good morning MaximG,

Late last night, I went to my laptop to see if I could find the EntityDac demos.... and I found them! I was able to get the demo running on the laptop, so this morning I will try to do the same on my desktop.

I was able to locate the examples on Expressions (which I think is what I want).

I did find a similar error message in the Demo about an invalid Metadata on the example referencing the Departments for the Employee. I am going to investigate further, and if possible I will be able to solve this challenge.

I'll post to the forum any findings I discover; and if I need additional detailed support I will build an example and send it to Support as you suggested.

Thank you for the reply!


Re: ChildEntity / Lookups / FieldExpressions

Posted: Tue 15 May 2018 14:48
by MaximG
We are glad that you could move forward. Contact us on any questions about using EntityDAC

Re: ChildEntity / Lookups / FieldExpressions

Posted: Thu 17 May 2018 14:55
by anykey

So; as I mentioned I located the demo files on my laptop, copied to my desktop. Got the EntityDemo app to run.

HOWEVER. I have RAD Studio XE7 and EntityDAC 1.4.7 pro. (also SDAC 7.2.8).

When Compiling and running on my IDE, the Demo correctly creates the Mathematical Expression demo, and the String expression demo. The Reference expression fails with an ELINQParserException '[TMetaTypeParser] Invalid metadata Dept'.

So, uninstalled my EntityDAC; downloaded and installed the Trial version -- hoping this is a bug in EntityDAC that could be fixed with an upgrade (which I am hoping to avoid because I am loathe to upgrade EntityDAC because now I'll also have to upgrade SDAC because Devart's products don't place nice together). ... Anyhow, when I try compiling and running the demo from my IDE, I get a Trial Expired error and can't connect to the data sources. Any way to reset that?

I then downloaded and ran the Compiled demo from the Devart website and None of the expressions examples work correctly. Running with dbExpress + SQLite selected....
> Mathematical : shows the MathExpr column only, all the regular columns disappear from the grid, throws the exception "edEmpNo: Field 'EmpNo' not found."
> String expression: shows the StrExpr column only, all the regular columns disappear from the grid, throws the exception "edEmpNo: Field 'EmpNo' not found."
> Reference expression: shows the DName column only, all the regular columns disappear from the grid, throws the exception "edEmpNo: Field 'EmpNo' not found."

Also, of note, I can't get the Demo to work at all on my Dev IDE with the dbExpress stack, I have to setup FireDAC, and to get it to work I need to include the FireDAC.Stan.Def and FireDac.Stan.Async units in the project source, drop a FDSchemaAdapter, FD SQLite driver link component, and the FD GUI Wait component on the demo form to get it to run.

So, in summary, I suspect there's a bug in my version of EntityDAC, but I don't want to drop $500 on upgrades if I can't confirm a but is the root cause. Based on running the compiled Demo, I'm 100% sure it's not my code or model with the issue.

First question :
Is there some way I could get the trial version to work again on my PC so that I can test if this is a bug that will be fixed in the newer version of EntityDAC?

And, second question:
If I do have to upgrade EntityDAC, will the latest version of EntityDAC work with SDAC 7.2.8?

Re: ChildEntity / Lookups / FieldExpressions

Posted: Fri 18 May 2018 15:04
by MaximG
1. We tested the behavior of the latest version of EntityDAC 1.7.13 Trial Edition according to your description and found no problems. We successfully executed the demo by selecting the "Expressions in EntityDataSet" section, dbExpress + SQLite as the data provider, as well as SDAC. You can test the behavior you are interested in again by using the latest versions of
EntityDAC and SDAC
2. In our test environment, we successfully installed EntityDAC 1.7.13 and SDAC 7.2.8