Dear Benoit, you just have to change the 'OrderMode' on your datasource.
Regards, Geoffrey Delmée ----- Mail Original ----- De: "benoit.billington" <benoit.billing...@yahoo.com> À: development-axapta@yahoogroups.com Envoyé: Mercredi 15 Avril 2009 11:55:21 GMT +01:00 Amsterdam / Berlin / Berne / Rome / Stockholm / Vienne Objet: [development-axapta] Query QueryBuildDataSource - Distinct records How can I have distinct record using the querybuilddatasource from AX 4.0 If I was using AX 2009 i think i could use the addGroupBy method but what can I do with AX4.0 ? public void executeQuery() { Query query = new Query(); QueryBuildDataSource qbsAppFamily; QueryBuildDataSource qbsInventTable; QueryBuildRange qbr, qbr2; ; qbsAppFamily = query.addDataSource(tablenum(ALXApplicationFamily)); qbsAppFamily.name(aLXApplicationFamily_DS.name()); qbsInventTable = qbsAppFamily.addDataSource(tablenum(InventTable) ); qbr = qbsInventTable.addRange(fieldNum(InventTable, ALFamilyCode)); qbr.value(strFmt('(ALXApplicationFamily.FamilyCode == ALFamilyCode)')); aLXApplicationFamily_DS.query(query); super(); } there's no relation between those 2 table, i just want to filter the ALXApplicationFamily table to show only the record present in the InventTable lines (since the FamilyCode is a field in that table) I managed to do it but if there are several times the same familyCode in InventTable, then it shows them all.... How can I specify "distinct" using QueryBuildDataSource or how can i use a select statement to work in a Form in the executeQuery Method?