Tuesday, November 3, 2015

AX 2012: Adding Query range Dynamically

    Query                   query;
    QueryRun                queryRun;
    QueryBuildDataSource    qbds1;
    QueryBuildRange         qbr1, qbr2,qbr3,qbr4;
 
    query = new Query();
    qbds1 = query.addDataSource(tableNum(Table_Name));
    if(Condition)
    {
         qbr1  = qbds1.addRange(fieldNum(Table_Name, Fieldname1));
         qbr1.value("Value");
    }
    if(Condition)
    {
         qbr2  = qbds1.addRange(fieldNum(Table_Name, Fieldname2));
         qbr2.value("Value");
    }
    if(Condition)
    {
         qbr3  = qbds1.addRange(fieldNum(Table_Name, Fieldname2 ));
         qbr3.value("Value");
    }
     if(Condition)
    {
         qbr4  = qbds1.addRange(fieldNum(Table_Name, Fieldname3));
         qbr4.value("Value");
    }
 
    queryRun = new QueryRun(query);

No comments:

Post a Comment

Table browser URL in D365FO

Critical Thinking icon icon by Icons8