AX – D365FO – X++ – Retrieve multiple occurrences of a DataSource in a QueryBuilDer with dataSourceTable method

When you make a query it can happen that you use more than one data source for the same table.

If you use the query builder you will have to set the filters on the right data source. If you have multiple data sources for the same table the only way to select the correct one is to select the one with the right index.

To do this you can use Query.dataSourceTable (Int32, Int32) Method.
In the first parameter you have to set the table id, while in the second the index corresponding to the data source you want to use (the first, the second, etc.)

public void method()
      QueryBuildDataSource        qbdsPurchLineA;
      QueryBuildDataSource        qbdsPurchLineA;

      qbdsPurchLineA = this.query().dataSourceTable(tableNum(PurchLine), 1);

      qbdsPurchLineA.addRange(fieldnum(PurchLine, PurchStatus)).value(queryvalue(PurchStatus::Backorder));

      qbdsPurchLineB = this.query().dataSourceTable(tableNum(PurchLine), 2);

      qbdsPurchLineB.addRange(fieldnum(PurchLine, PurchStatus)).value(queryvalue(PurchStatus::Backorder));


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