当前位置: 动力学知识库 > 问答 > 编程问答 >

axapta - Why I have Field dataAreaId Access denied in a Query?

问题描述:

I have a problem, I used in my init Form a little Query.

I used this code :

query q = new Query();

QueryBuildDataSource qbds;

QueryRun queryRun;

qbds.addRange(fieldNum(MyTable,dataAreaId)).value(SysQuery::valueUnlimited());

queryRun = new queryRun(q);

if (! queryRun.prompt())

{

element.close();

}

MyTable_ds.query(queryRun.query());

When I insered a value in my query prompt I will have a error message :

"Can not select the Company field."

I have in my Design and dataSource this field , but I can't use in a Query.

All other fields I can use without problems.

It's possible to use this field in a query?

Thanks your time,

enjoy!

网友答案:

You cannot include DataAreaId in your queries.

You can however use addCompanyRange method on your query:

q.addCompanyRange("dat");

Try this:

query q = new Query();
QueryBuildDataSource qbds;   
QueryRun queryRun;

qbds = q.addDataSource("MyTable");
//Build you query 

q.allowCrossCompany(true);
q.addCompanyRange("dat");

queryRun = new queryRun(q);
if (! queryRun.prompt())
{
    element.close();
}
MyTable_ds.query(queryRun.query());
分享给朋友:
您可能感兴趣的文章:
随机阅读: