Hi,
Data from a CRUD endpoint is shown in a datagrid. The table (Users) involved contains a foreign key to another table (Language).
Is it possible to show a referenced field from the other table in the CRUD endpoint?
Hi,
Data from a CRUD endpoint is shown in a datagrid. The table (Users) involved contains a foreign key to another table (Language).
Is it possible to show a referenced field from the other table in the CRUD endpoint?
This section of documentation explains how associations work in CRUD endpoints:
Got a few steps further.
The field Language_Id (Integer) in table Users is now defined in the entity unit as follows. The entity unit is generated via Data Modeler.
[Association([TAssociationProp.Lazy], CascadeTypeAll - [TCascadeType.Remove])]
[JoinColumn('LANGUAGE_ID', , 'ID')]
FLanguage_Id: Proxy;
function GetLanguage_Id: TLanguage;
procedure SetLanguage_Id(const Value: TLanguage);
QueryString in dataset is:
'$select=Id,Login,Pwd,Role,Firstname,Lastname,Email,Mobile,Phone,Language_Id,Language_Id/Language&$expand=Language_Id
The error message "Invalid type conversion to Variant in field Language_Id" shows up in the console log.
Any idea what is wrong?
Could you please send the call stack at the moment of the error?
Also, please try it this way:
'$select=Id,Login,Pwd,Role,Firstname,Lastname,Email,Mobile,Phone,Language_Id/Language&$expand=Language_Id
Attached is the call stack.
XData_20250527.txt (4.5 KB)
Tried also the changed query string but got the same error.