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