| Customer |
Product |
Product Reference |
| Cust1 |
P1 |
|
| Cust1 |
P2 |
|
| Cust1 |
P3 |
|
| Cust2 |
P4 |
|
| Cust2 |
P5 |
|
| Cust2 |
P6 |
|
| Cust3 |
P7 |
|
| Cust3 |
P8 |
|
| Cust3 |
P1
|
I have a non datasource field, 'Customer' on a form, which is displaying all the customer records through the following lookup() method. But I want to display distinct customers rather than displaying all the customer entries(for ex: from the above table, it is displaying the Cust1 3 times, Cust2 3 times etc.) like Cust1, Cust2, Cust3 etc). Where and how do I add 'Distinct' condition on 'Customer'field in the table.
public void lookup()
{
QueryBuildDataSource qdbs;
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(CustProductRelationTable), this);
Query query = new Query();
qdbs = query.addDataSource(tableNum(CustProductRelationTable));
qdbs.addRange(fieldNum(CustProductRelationTable, EndDate)).value(queryValue(dateNull()));
sysTableLookup.addLookupfield(fieldNum(CustProductRelationTable, AccountNum));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}