AX – D365FO – Clear data source query ranges

If you add a query range with a certain value to a Query, then next time you execute the query with another value the query doesn’t clear previous range.

In order to clean the old values you have to use clearRanges() method

see example below

        /// </summary>
public void executeQuery()
            QueryBuildDataSource productCategory_ds = this.query().dataSourceTable(tableNum(Al0VendorSearchCriteria));

            int i = ActivityTree.getSelection();
            if(ActivityTree.getSelection() != 0)
                int64 currentNodeSelected = ActivityTree.getItem(ActivityTree.getSelection()).data();
                if(currentNodeSelected != 0)
                    productCategory_ds.addRange(FieldNum(Al0VendorSearchCriteria, VendorActivityRefRecId)).value(int642Str(currentNodeSelected));



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...