首页 > 代码库 > AX 2012 取得Form或Query的 所有DataSources

AX 2012 取得Form或Query的 所有DataSources

static void AllDataSourcesInQuery(Args _args)
{
    Args args = new Args();
    Query                       query;
    QueryRun                    queryRun;
    counter i;
    ;

   
    query = new query(queryStr(CustConsInvoiceConstruction_JP));
    queryRun = new QueryRun(query);

    for(i=1 ; i<=query.dataSourceCount();i++)
    {
        info(new DictTable(query.dataSourceNo(i).table()).name());
    }
}

 

static void AllDataSourcesInForm(Args _args)
{
    Args args = new Args();
    FormRun fr;
    FormBuildDataSource formBuildDataSource;
    counter i;
    ;
    args.name("CustTable");   // its your FORM name
    fr = ClassFactory.formRunClass(args);
    for(i=1 ; i<=fr.form().dataSourceCount();i++)
    {
        formBuildDataSource = fr.form().dataSource(i);
        info(new DictTable(formBuildDataSource.table()).name());
    }
   
}

AX 2012 取得Form或Query的 所有DataSources