how to get static range in your report

蓝咒 提交于 2019-12-25 15:54:19

问题


In AX Report the User can select different Range. I seek to show that the criteria used to filter user in the report itself even

the expression "parameter!CustomerAccount.Value" don't work because this filter is not a static parameter.

the user can use any table from the query and any field from the table and any criteria.. I'm locking for trick to get for which table, which field and what criteria it uses.


回答1:


this method work very well ^_^

(( I use it privet and not static ))

    static void getQueryRanges2(Args _args)
{
 Query query;
 QueryRun queryRun;
 QueryBuildDataSource qbd;
 QueryBuildRange range;
 QueryFilter filter;
 int cnt, filtercnt, i,j, k;
 DictTable dictTable;
 DictField dictField;
 str fieldLabel;
 ;
 query = new query(queryStr(smmSalesCustItemStatistics));
 queryRun = new QueryRun(query);
 queryRun.prompt();
 query = queryRun.query();  for(i = 1; i <= query.dataSourceCount(); i++)
 {
    cnt = query.dataSourceNo(i).rangeCount();
    filtercnt = 0;
    if(!query.dataSourceNo(i).embedded())
    {
        filtercnt = query.queryFilterCount(query.dataSourceNo(i));
    }
    dictTable = new DictTable(query.dataSourceNo(i).table());
    for (k=1; k<= filtercnt; k++)
    {
        filter = query.queryFilter(k, query.dataSourceNo(i));
        dictField = new DictField(query.dataSourceNo(i).table(), fieldname2id(query.dataSourceNo(i).table(), filter.field()));
        info (strFmt("%1, %2. Range = %3", dictTable.label(), dictField.label(), filter.value()));
    }
    for (j=1; j<=cnt; j++)
    {
        range = queryRun.query().dataSourceNo(i).range(j);
        dictField = new DictField(query.dataSourceNo(i).table(), fieldname2id( query.dataSourceNo(i).table(), range.AOTname()));
        if(range.value())
        {
            info(strfmt("%1, %2. Range = %3",dictTable.label(), dictField.label(), range.value()));
        }
    }
 }
}

enjoy :)



来源:https://stackoverflow.com/questions/14828505/how-to-get-static-range-in-your-report

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!