Hello everyone,
I have a specific scenario I want to implement. I have two tables: the first one is called ViolationGroup and the second one is ViolationTypes. In the first table, I have two fields: GroupCode
and Description
. Similarly, in the second table, I have ViolationCode
and ViolationType
, as well as a field that should be linked to the RecId
of the ViolationGroup table.
I also have a form with a grid bound to the ViolationTypes table. I defined the fields of the ViolationTypes table in the grid. When I reached the GroupCode
field, I wanted to create a dropdown list that displays all the data from ViolationGroup, and upon selecting any ViolationGroup, only the GroupCode
should be displayed.
Here’s the code I implemented:
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(ViolationGroup), sender);
Query query = new Query();
sysTableLookup.addLookupfield(fieldNum(ViolationGroup, ViolationGroupCode), true);
sysTableLookup.addLookupfield(fieldNum(ViolationGroup, ViolationGroupDescription));
QueryBuildDataSource qbds = query.addDataSource(tablenum(ViolationGroup));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
FormControlCancelableSuperEventArgs ce = e as FormControlCancelableSuperEventArgs;
ce.CancelSuperCall();
However, the RecId
of the field is still being displayed, so I resorted to using a Reference Group by following the instructions in this video:
https://www.youtube.com/watch?v=vpRrNL-GfbY
This was a suitable solution but not an optimal one. What I want is to display all the data from the ViolationGroup table, and upon selecting any field, only the field I specify (like GroupCode
) should be displayed. However, the Reference Group tool displays the fields I’ve defined in the index of the table it’s linked to.
What I want to achieve is the ability to display all the data from the table using a Reference Group while maintaining the display of GroupCode
in the cell—exactly as it works when selecting a customer in the Sales Order form.
I hope I’ve explained my issue clearly. If anything is unclear or needs further clarification, please let me know so I can elaborate further.