Hi All,
Help me please to resolve my problem. On the form field (combobox)related with the field(enum) of the table. I need to, under certain conditions, a drop-down list was not complete, it does not lose relation with the field of the table. That would show the current value from the table.
Example
MyEnum contains 3 items
MyEnum::El1; 0
MyEnum::El2; 1
MyEnum::El3; 2
Record of table 1 Value of field - 0 MyEnum::El1
enable for select all list Enume
Record of table 2 Value of filed 1 MyEnum::El2
enable for select only MyEnum::El2 and MyEnum::El3;
Record of table 3 Value of filed 0 MyEnum::El1
enable for select only MyEnum::El and MyEnum::El3;
Override lookup() method of the datasource field and implement your own lookup (see How to: Add a Lookup Form to a Control). There add a query range with the value of the enum field.
Does not work, I Override lookup() method of the datasource field, and put BreakPoint in method,
but in the choice of values the program does not will break. It’s successfully work if control type of String, but not type of Enum Combobox.
public void lookup(FormControl _formControl, str _filterStr)
{
; Query query = new Query();
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRange;
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(DealPassport), _formControl);
;
breakpoint;
sysTableLookup.addLookupField(fieldNum(DealPassport, DealResult));
queryBuildDataSource = query.addDataSource(tableNum(DealPassport));
queryBuildRange = queryBuildDataSource.addRange(fieldNum(DealPassport, DealResult));
queryBuildRange.value(sysQuery::valueNot(enum2str(DealResult::CancelledByCust)));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
// super(_formControl, _filterStr);
}
Sorry, I misunderstood your requirement.
Consider using SysFormEnumComboBox class or putting element names to a temporary table as strings (and using a normal lookup instead of a combobox).