Here in this example demonstrates how to make a look up form for a sub categories regarding to the selected category in grid and you can do the same for any controls.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
AssetComponentsTable: the items table
AssetComponentsGroup: the group field CompGroupId
AssetComponentsSubGroup: the sub group field CompSubGroupId
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Note: In the grid control the field of CompGroupId make the AutoDeclaration true
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void lookup()
{
// super();
QueryBuildDataSource qbds;
Query q = new Query();
QueryBuildRange qbr;
SysTableLookup s = SysTableLookup::newParameters(tableNum(AssetComponentsSubGroup),this);
s.addLookupField(fieldnum(AssetComponentsSubGroup,CompSubGroupId));
s.addLookupField(fieldnum(AssetComponentsSubGroup,Name));
qbds = q.addDataSource(tableNum(AssetComponentsSubGroup),"AssetComponentsSubGroup");
qbr = qbds.addRange(fieldnum(AssetComponentsSubGroup,CompGroupId));
qbr.value(AssetComponentsTable.CompGroupId);
s.parmQuery(q);
s.performFormLookup();
}
No comments:
Post a Comment