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.
Hello @Layan Jwei,
I have already read your response to my question, but I keep finding myself stuck at the same point I started from. Either I end up with a ReferenceGroup containing only ViolationGroupCode, or I get a ReferenceGroup containing both ViolationGroupCode and ViolationTypesDescription. However, in this case, both fields are displayed in the cell, unlike the way it works with Title1 and Title2.
André Arnaud de Cal...
292,162
Super User 2025 Season 1
Martin Dráb
230,962
Most Valuable Professional
nmaenpaa
101,156