Hi,
Here is the situation :
I have a form with a grid populated with ProdTable as datasource. This DS has some range for different purpose. I have created a lookup to continue filtering more and more my datasource. Until now, i have no problem, this works very well.
Now in addition, I want to filter my lookup based on my form datasource value. I want the values possible in my lookup are the values possible from data in my form datasource.
Exemple :
Form datasource
Id | Value |
1 | A |
2 | B |
3 | C |
Lookup
Value |
A |
B |
C |
Form datasource
Id | Value |
1 | A |
3 | C |
Lookup
Value |
A |
C |
Here is my lookup code
public void lookup()
{
SysTableLookup lookup;
Query q = new Query();
QueryBuildDataSource qbds, qbds2, qbds3;
QueryBuildRange qbr;
lookup = SysTableLookup::newParameters(tableNum(EcoResProduct), this);
qbds = q.addDataSource(tableNum(EcoResProduct));
qbds2 = qbds.addDataSource(tableNum(InventTable));
qbds2.relations(true);
qbds2.joinMode(JoinMode::InnerJoin);
qbds3 = qbds2.addDataSource(tableNum(ProdTable));
qbds3.relations(true);
qbds3.joinMode(JoinMode::InnerJoin);
// QBDS3.prodId = ProdTable_DS.prodId
qbds.addGroupByField(fieldNum(EcoResProduct, AVADiametreCirconscrit));
lookup.addLookupField(fieldNum(EcoResProduct, AVADiametreCirconscrit));
lookup.parmQuery(q);
lookup.performFormLookup();
}
Can anyone help me to achieve this ?
Thank you, Stéphane M.
*This post is locked for comments