AX – D365FO – Clear a value of a previously query set filter

If you have done a query in a form and you you want to clean previouslu query filter you have to follo w this code

public void executeQuery()


   // Get the filter value from the filter control.

   date firstYearOfMonth;
   str monthStr;
   str yearStr;
   MonthsOfYear monthEnum;
   int monthEnumToInt;
   TransDate tmpDate;
   TransDate dateInMonth;
   TransDate firstDateOfMonth;
   TransDate endDateOfMonth;
   QueryBuildDataSource ds;
   monthStr = MonthsList.valueStr();
   yearStr = YearsList.valueStr();
   ds = this.query().dataSourceTable(tablenum(ERAWriteOffCalculation));

   if (yearStr != "")
       monthEnum = str2enum(monthEnum,monthStr);
       monthEnumToInt = enum2int(monthEnum);
       tmpDate = str2Date("15/" + int2str(monthEnumToInt) + "/" + yearStr, 123);
       firstDateOfMonth = DateStartMth(dateInMonth);
       endDateOfMonth= endmth(dateInMonth);
        ds.addRange(fieldNum(ERAWriteOffCalculation, calcdate)).value(queryRange(firstDateOfMonth, endDateOfMonth));

       ds.clearRange(fieldNum(ERAWriteOffCalculation,calcdate)); //This code cear previously set filters


Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo di

Stai commentando usando il tuo account Chiudi sessione /  Modifica )

Google photo

Stai commentando usando il tuo account Google. Chiudi sessione /  Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione /  Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione /  Modifica )

Connessione a %s...