【问题标题】:AX 2012 how to set args record datasource in X++AX 2012 如何在 X++ 中设置 args 记录数据源
【发布时间】:2014-01-31 16:21:32
【问题描述】:

谁能告诉我在执行以下语句后我应该在 X++ 中做什么才能从 args.record().datasource() 方法中获取 NOT null 值:

PurchTable    purchTable;

args.record(purchTable);

if(args.record().datasource())  //this condition fails because of null value
{
    //I have to reach here
}

我知道从 Form 调用相同的代码时可以正常工作,但我的情况是我必须从 X++ 中执行此代码。请帮忙!

【问题讨论】:

    标签: x++ dynamics-ax-2012 args


    【解决方案1】:

    args.record().datasource() 将检索表单数据源。在这里,您仅使用表缓冲区。这就是为什么你什么都没有。

    如果你想检索表缓冲区,你可以这样:

    PurchTable purchTable;
    PurchTable argPurchTable;
    
    select firstOnly purchTable;
    args.record(purchTable);
    
    if (args.record() && args.dataset() == tableNum(PurchTable))
    {
        argPurchTable = args.record();
        //do something
    }
    

    问候,

    杰弗里

    【讨论】:

    • 不知道“args.dataset() == tableNum(PurchTable)”够不够用? Forms>CustTrans>Datasources>CustTrans>executeQuery() 中有一个例子
    • "args.dataset() == tableNum(PurchTable)" 只是为了测试 TableId 以防止将 SalesTable 缓冲区放入 PurchTable 中。 args.record() 足以测试一条记录是否通过。
    • 这没有回答所提出的问题
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多