Jan 4, 2015

Creating dynamic relation for a datasource at form level

public void executeQuery()
{
    QueryBuildDataSource    qbds;
    Query                   qr;
    EcoResProduct           EcoResProduct; 
    ;
    this.query().dataSourceTable(tableNum(xyzEcoResProduct)).clearRanges();
   
    if(FormControl_Filter.valueStr())
    {
        this.query().dataSourceTable(tableNum(xyzEcoResProduct)).relations(false);
        select RecId from EcoResProduct where EcoResProduct.SeriesId == FormControl_Filter.valueStr();
        qbds = this.query().dataSourceTable(tableNum(xyzEcoResProduct));
        qbds.joinMode(JoinMode::InnerJoin);
        qbds.addRange(fieldNum(xyzEcoResProduct, ItemSeries)).value(queryValue(EcoResProduct.RecId));
    }
   
    super();
}

No comments: