Dictionary for one-to-many relations


I'm just trying to use the "new" dictionary with something like this:

Tperson - many Tcodes

Tperson has a property Tperson.codes: TList

But in the generated dictionary (DataModeler) there is no property "codes". I'd like to do something like

lPerson := Manager.Find<Tperson>.Where(Dic.person.codes.id = 6).UniqueResult;

Do I miss something or is this just not possible?


Works here. See project attached.

TestDictionaryManyValued.zip (6.5 KB)

Hello Wagner,

thanks for Your fast answer. Yes, with the code that You provided, I get the correct dictionary definition. But I used DataModeler - and there I get a different definition. I appended the settings of DataModeler in a screenshot and one file of DataModeler (test1.pas) and one created by the code (testaurelius2.pas):

TDictionaryGenerator.GenerateFile(TPath.ChangeExtension(ParamStr(0), '.pas'));

Kind regards
aurelius_dictionary.zip (47.7 KB)

one thing to mention with Your code: In the dictionary that was created by code all properties have the leading "F" - so e.g. it's "Fcodes" and not "codes". Is it possible to change this?

Kind regards


Weird! Now I see it needs Camel Case.

If you use FId instead of Fid; FCode i/o Fcode .... then TDictionaryGenerator.GenerateFile will work.

Hi, thank You for this solution - but this means, if I use this model for Xdata and get the Result as JSON then there is a difference between "Codes" and "codes". So maybe You consider to change this "feature"? For a pure Xdata-Application there is no problem, if I use the server and client from Xdata. But if I use a different Client, maybe in php or python then I will get problems with differences in lower and upper case field names.

And, is there a solution for creating the dictionary with DataModeler (see my previous post)? Or do I have to post this question in the DataModeler-Forum?

Kind Regards

Maybe Wagner will help you. I always used camel-case with DataModeler, and I've been using all the new dictionary features very well.
About the capital letters, I really don't know if it's the real and only problem - I found the solution by comparing your model with my models and Wagner's model in the example project. The main difference was properties' case; and changing Wagner's model to lowercase properties also made it add and F when generating the dictionary.

I was able to reproduce the issue here. Will investigate what's going on.

This issue is now fixed in Data Modeler version 3.12.

1 Like

Hi Wagner,

thank You very much. Now everything works as expected. As always: great support!

Kind Regards

1 Like

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.