【问题标题】:Why I have Field dataAreaId Access denied in a Query?为什么我在查询中拒绝了字段 dataAreaId 访问?
【发布时间】:2015-05-07 07:05:28
【问题描述】:

我有一个问题,我在我的初始化 Form 中使用了一个小查询。 我使用了这段代码:

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());

当我在 查询提示 中插入一个值时,我会收到一条错误消息:

“无法选择公司字段。”

我的 Design 和 dataSource 中有这个字段,但我不能在查询中使用。 我可以毫无问题地使用所有其他字段。

可以在查询中使用该字段吗?

感谢您的宝贵时间,

享受吧!

【问题讨论】:

    标签: axapta x++ query-builder dynamics-ax-2012


    【解决方案1】:

    您不能在查询中包含DataAreaId。

    您可以在查询中使用addCompanyRange 方法:

    q.addCompanyRange("dat");
    

    试试这个:

    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());
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-21
    • 1970-01-01
    • 1970-01-01
    • 2022-12-05
    • 2012-02-07
    相关资源
    最近更新 更多