///
///
///
///
///
[FormControlEventHandler(formControlStr(InventParameters, GroupSetup_LocationDimensionAttribute), FormControlEventType::Lookup)]
public static void GroupSetup_LocationDimensionAttribute_OnLookup(FormControl sender, FormControlEventArgs e)
{
InventParametersEventHandlers::createLookup(sender);
FormControlCancelableSuperEventArgs cancelableArgs = e as FormControlCancelableSuperEventArgs;
cancelableArgs.CancelSuperCall();
}
private static void createLookup(FormReferenceGroupControl _ctrl)
{
SysReferenceTableLookup sysReferenceTableLookup;
Query query;
QueryBuildDataSource qbdsDimensionAttribute;
QueryBuildDataSource qbdsDimensionAttributeSetItem;
sysReferenceTableLookup = SysReferenceTableLookup::newParameters(tableNum(DimensionAttribute), _ctrl);
sysReferenceTableLookup.addLookupfield(fieldNum(DimensionAttribute, Name));
// This query must be kept in sync with the one used on the DimensionDefaultingControllerBase.setupEditAreaControls() method
query = new Query();
qbdsDimensionAttribute = query.addDataSource(tableNum(DimensionAttribute));
qbdsDimensionAttribute.addRange(fieldNum(DimensionAttribute, Type)).value(SysQuery::valueNot(DimensionAttributeType::MainAccount));
qbdsDimensionAttribute.addOrderByField(fieldNum(DimensionAttribute, Name));
qbdsDimensionAttributeSetItem = qbdsDimensionAttribute.addDataSource(tableNum(DimensionAttributeSetItem));
qbdsDimensionAttributeSetItem.joinMode(JoinMode::ExistsJoin);
qbdsDimensionAttributeSetItem.fetchMode(QueryFetchMode::One2One);
qbdsDimensionAttributeSetItem.relations(true);
qbdsDimensionAttributeSetItem.addRange(fieldNum(DimensionAttributeSetItem, DimensionAttributeSet)).value(
queryValue(DimensionCache::getDimensionAttributeSetForLedger()));
sysReferenceTableLookup.parmQuery(query);
sysReferenceTableLookup.performFormLookup();
}
No comments:
Post a Comment