I'm trying to convert code to ORDA. One thing that is giving me issues is Relations. Example setup:
Tables:
[CallLogs]
, [Employees]
Relation:
[CallLogs]EmployeeID
(M)---->(O) [Employees]UniqueID
MtO Relation Name: "RelatedEmployee".
Using ORDA, I can do this:
ds["CallLogs"].query("......").toCollection("Date, Subject, RelatedEmployee.Name")
If I was to put in a fieldname into .toCollection()
that wasn't real, 4D will throw an error. This is fine when I control the input. However, in a web API where the client can specify fields, I don't want to throw errors, but instead just drop any incorrect field names silently, or return an error message. Throwing a 4D error stops the process.
Previously, when I used Selection to JSON
, I'd specify fields from linked tables as TableName_FieldName
, and I could split it, then verified the table and field name against a table structure object. However, since ORDA uses Relation Name, instead of Table Name, I don't know what to do. I can't find anything that will take a relation name and give me back a table. Or, alternatively, I can't find a way to suppress errors in .toCollection()
. Ideally, .toCollection()
would just ignore field names that weren't real.
Any help would be appreciated on how to proceed.