X++来自QueryRun In Fetch方法



我似乎找不到解决方案。我修改了报告中的 Fetch 方法,以便如果更改了 queryRun 并获取了新 ID,则 while 循环将重新开始并出现一个新页面并执行 2 个元素。这部分工作正常,下一部分不工作,在每个ID中都有我正在使用Element.Execute()的几个记录;和元素。发送();进行处理。发生的情况是,选择第一个 ID,执行报告的元素(正文),并按预期发送元素,但是 while 循环不会进入下一个 ID?

这是代码;

public boolean fetch()
{
    APMPriorityId           oldVanId, newVanId;
    LogisticsControlTable   lLogisticsControlTable;
    int64                   cnt, counter;
    ;
    queryRun = new QueryRun(this);
    if (!queryRun.prompt() || !element.prompt())
    {
        return false;
    }
    while (queryRun.next())
    {
        if (queryRun.changed(tableNum(LogisticsControlTable)))
        {
            lLogisticsControlTable = queryRun.get(tableNum(LogisticsControlTable));
            if (lLogisticsControlTable)
            {
                info(lLogisticsControlTable.APMPriorityId);
                cnt      = 0;
                oldVanId =  newVanId;
                newVanId =  lLogisticsControlTable.APMPriorityId;
                if(newVanId)
                {
                    element.newPage();
                    element.execute(1);
                    element.execute(2);
                }
            }
            if (lLogisticsControlTable.APMPriorityId)
            select count(recId) from lLogisticsControlTable where lLogisticsControlTable.APMPriorityId == newVanId;
            counter = lLogisticsControlTable.RecId;
            while select lLogisticsControlTable where lLogisticsControlTable.APMPriorityId == newVanId
            {
                cnt++;
                if(lLogisticsControlTable.APMPriorityId == newVanId && cnt <= counter)
                {
                    element.execute(3);
                    element.send(lLogisticsControlTable);
                }
            }
        }
    }
    return true;
}

您正在使用lLogisticsControlTable作为queryRun.get()while select的目标。但是,这两种用途会干扰;有两个 SQL 游标要控制。

使用两个不同的记录变量。

最新更新