Hi,
/// <summary>
/// Provides the look-up interaction for the individual dimension value lookup controls.
/// </summary>
/// <param name="_dimensionValueControl">
/// The <c>FormStringControl</c> enumeration value that triggers this event.
/// </param>
/// <param name="_localizedName">
/// The localized dimension attribute name
/// </param>
/// <param name="_promptErrorMessage">
/// Whether prompt the error message if the dimension type is empty.
/// </param>
public static void dimensionValueLookup(
FormStringControl _dimensionValueControl,
Name _localizedName,
boolean _promptErrorMessage = false)
{
Query query = new Query();
SysTableLookup sysTableLookup;
QueryBuildDataSource qbds;
DimensionAttribute dimensionAttribute;
RecId dimensionAttributeId;
DataAreaId dataAreaId = curext();
if (_localizedName)
{
dimensionAttribute = DimensionAttribute::findByLocalizedName(_localizedName, false, currentUserLanguage());
dimensionAttributeId = dimensionAttribute.RecId;
}
if (dimensionAttributeId)
{
sysTableLookup = SysTableLookup::newParameters(DimensionCache::instance().dimensionAttributeBackingTable(dimensionAttributeId), _dimensionValueControl);
sysTableLookup.addLookupfield(dimensionAttribute.ValueAttribute);
LedgerDimensionTranslationLookupHelper::addLookupTranslation(sysTableLookup, dimensionAttributeId);
sysTableLookup.addSelectionField(dimensionAttribute.NameAttribute);
changeCompany(dataAreaId)
{
qbds = query.addDataSource(DimensionCache::instance().dimensionAttributeBackingTable(dimensionAttributeId));
qbds.addOrderByField(DimensionCache::instance().dimensionAttributeValueField(dimensionAttributeId));
DimensionAttribute::restrictQueryToCategorizedValues(qbds, dimensionAttributeId);
}
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
else if (_promptErrorMessage)
{
//Please choose a value for "Dimension type" first!
checkFailed("@GLS100015");
}
}
Regards