I’m filtering records by adding a range after changing the value of a combobox on a form. This is a modified method of the combobox. If the value is MyValue, I want to see only records where myField equals to myEnum2::MyValue. This works just fine if there are such records in my table, but if there are no such records, AX creates a new one, how can I disable this? Why is AX creating a new record?
public boolean modified()
{
boolean ret;
ret = super();
if (this.valueStr() == enum2Str(myEnum1::MyValue))
{
myTable_DS.query().dataSourceTable(tableNum(myTable)).clearRange(fieldNum(myTable, myField));
myTable_DS.query().dataSourceTable(tableNum(myTable)).addRange(fieldNum(myTable, myField)).value(SysQuery::value(myEnum2::MyValue));
}
myTable_DS.executeQuery();
return ret;
}
Version is AX 2009