Do this : 
qbsInventTable.orderMode(OrderMode::GroupBy);
qbsAppFamily.orderMode(OrderMode::GroupBy);

It didn't work cuz in fact there's no distinct record. my bad!

It's only in the grid that both records are distinct, but in fact they are 
different cuz of some other fields which are not useful in this case.

there's no relation between the 2 tables.

What I want to do is to display all the ApplicationFamilyName
that are used in the InventTable
so they can appear more than one time.
I gotta think again on how to make this query ;)

--- In [email protected], enki...@... wrote:
>
> Dear Benoit,
> 
> you just have to change the 'OrderMode' on your datasource.
> 
> Regards,
> Geoffrey Delmée
> 
> 
> ----- Mail Original -----
> De: "benoit.billington" <benoit.billing...@...>
> À: [email protected]
> 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?
>


Reply via email to