简体   繁体   中英

AX2012 Using Select query to display data in a data grid view

i have new form and I am looking for to display all record in grid byn specifying my own query ,the fonction may be as well:

static void  queryVendtableSelect(Args _args)
{
    VendTable vendTable;

    while select firstOnly  *
    from vendTable
    order by   vendTable.AccountNum
     where vendTable.Blocked =="aaaaaaaaa"


    }

when can i put this fontion? any idea. thank you

For the provided example you can override the init method in the VendTable datasource as follows:

public void init()
{
    QueryBuildDataSource qbds;
    QueryBuildRange qbr;

    super();

    qbds = this.query().dataSourceTable(tableNum(VendTable));
    qbds.sortClear();
    qbds.addSortField(fieldNum(VendTable, AccountNum));
    qbr = SysQuery::findOrCreateRange(qbds, fieldNum(VendTable, Blocked));
    qbr.value(queryValue('aaaaaaaaa')); 
}

You could overwrite the init or executeQuery method of the form datasource that references your table. In the overwritten method, you can create a new query and set it as the query of the datasource or you can modify the query of the datasource. See How to filter records in a form by code for an example of modifying the datasource query.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM