/// <summary> /// Look up to filter system generated financial dimension names /// </summary> /// <param name="sender"></param> /// <param name="e"></param> [FormControlEventHandler(formControlStr(HRMParameters, VKAPDPayrollSystem_VKADPCostCentreDim), FormControlEventType::Lookup)] public static void VKAPDPayrollSystem_VKADPCostCentreDim_OnLookup(FormControl sender, FormControlEventArgs e) { FormReferenceControl formControl = sender as FormReferenceControl; SysReferenceTableLookup sysReferenceTableLookup = SysReferenceTableLookup::newParameters(tablenum(DimensionAttribute), formControl); Query query = new Query(); QueryBuildDataSource queryBuildDataSource = query.addDataSource(tableNum(DimensionAttribute)); // Ranges from DimensionDetails(CSL).init(), which are applied to standard form General ledger / Chart of accounts / Dimensions / Financial dimensions queryBuildDataSource.addRange(fieldNum(DimensionAttribute, Type)).value(QueryValue(DimensionAttributeType::CustomList)); queryBuildDataSource.addRange(fieldNum(DimensionAttribute, Type)).value(QueryValue(DimensionAttributeType::ExistingList)); sysReferenceTableLookup.addLookupField(fieldNum(DimensionAttribute, Name)); sysReferenceTableLookup.parmQuery(query); sysReferenceTableLookup.performFormLookup(); FormControlCancelableSuperEventArgs ce = e as FormControlCancelableSuperEventArgs; ce.CancelSuperCall(); }Ranges copied from DimensionDetails.init():
/// <summary> /// Initializes the dimension attribute data source to restrict to the records that are required by the /// launching form. /// </summary> public void init() { dimensionAttribute_ds.query().dataSourceTable(tablenum(DimensionAttribute)).addRange(fieldnum(DimensionAttribute, Type)).value(queryValue(DimensionAttributeType::ExistingList)); dimensionAttribute_ds.query().dataSourceTable(tablenum(DimensionAttribute)).addRange(fieldnum(DimensionAttribute, Type)).value(queryValue(DimensionAttributeType::CustomList)); dimensionAttribute_ds.query().dataSourceTable(tablenum(DimensionAttribute)).findRange(fieldnum(DimensionAttribute, Type)).status(RangeStatus::Locked); Set availableBackingEntityTypes = DimensionEnabledType::getAvailableDimensionBackingEntityTypes(); // Only include DimensionAttributes that have backing entities SetEnumerator setEnumerator = availableBackingEntityTypes.getEnumerator(); while (setEnumerator.moveNext()) { dimensionAttribute_ds.query().dataSourceTable(tablenum(DimensionAttribute)).addRange(fieldnum(DimensionAttribute, BackingEntityType)).value(queryValue(setEnumerator.current())); } }DimensionEnabledType::getAvailableDimensionBackingEntityTypes() - is internal and therefore cannot be called from different models
DaxOnline.org is free platform that allows you to quickly store and reuse snippets, notes, articles related to Dynamics AX.
Authors are allowed to set their own AdSense units.
Join us.