Более сложный вариант, со своим лукапом.
Ваша проблема в fscInventLocationRange.replaceOnLookup(false);
X++:
public class myRunBase extends RunBase
{
DialogRunBase dialogRunBase;
Range inventLocationRange;
FormStringControl fscInventLocationRange;
....
}
DialogRunbase dialog(DialogRunbase dialog, boolean forceOnClient)
{
FormGroupControl fgc;
dialogRunbase = super(dialog, forceOnClient);
fgc = dialogRunBase.curFormGroup();
fscInventLocationRange = fgc.addControl(FormControlType::String, @"InventLocationRange");
fscInventLocationRange.extendedDataType(extendedTypeNum(InventLocationId));
fscInventLocationRange.text(inventLocationRange);
fscInventLocationRange.replaceOnLookup(false);
fscInventLocationRange.displayLength(50);
fscInventLocationRange.limitText(250);
...
}
public void dialogPostRun(DialogRunbase _dialog)
{
if (_dialog.formRun())
{
_dialog.formRun().controlMethodOverloadObject(this);
_dialog.formRun().controlMethodOverload(true);
fscInventLocationRange = _dialog.formRun().design().control(fscInventLocationRange.id());
}
super(_dialog);
}
private void InventLocationRange_lookup()
{
SysTableLookup sysTableLookup;
EmplTable emplTable = EmplTable::findByUserId_W(curuserid());
Query query = new Query();
QueryBuildDataSource queryBuildDataSource;
;
if (!dialogRunbase)
return;
if (fscInventLocationRange)
{
sysTableLookup = SysTableLookup::newParameters(tableNum(InventLocation), fscInventLocationRange);
queryBuildDataSource = query.addDataSource(tableNum(InventLocation));
if (emplTable.myInventSite)
{
queryBuildDataSource.addRange(fieldNum(InventLocation, InventSiteId)).value(queryValue(emplTable.myInventSite));
}
sysTableLookup.addLookupfield(fieldNum(InventLocation, InventLocationId));
sysTableLookup.addLookupfield(fieldNum(InventLocation, Name));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
}