gpt4 book ai didi

axapta - SysTableLookup 的查找方法错误?

转载 作者:行者123 更新时间:2023-12-02 04:56:47 24 4
gpt4 key购买 nike

此代码应适用于添加到 Tables\ProdBOM 的任何基本系统。查询以某种方式从字段中剥离数据。

static void lookupItemIdBOMSubset(FormStringControl   _ctrl,
ProdId _prodId)
{
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(ProdBOM), _ctrl);
Query query = new Query();
QueryBuildDataSource qbds = query.addDataSource(tableNum(ProdBOM));
;

qbds.addRange(fieldNum(ProdBOM, ProdId)).value(queryvalue(_prodId));
qbds.addSortField(fieldNum(ProdBOM, LineNum), SortOrder::Ascending);

sysTableLookup.parmQuery(query);

sysTableLookup.addLookupfield(fieldNum(ProdBOM, LineNum));
sysTableLookup.addLookupfield(fieldNum(ProdBOM, BOMId));
sysTableLookup.addLookupfield(fieldNum(ProdBOM, ItemId), true);

// This doesn't work \/
sysTableLookup.addLookupMethod(tablemethodstr(ProdBOM, configId));
// This doesn't work /\

sysTableLookup.addLookupMethod(tablemethodstr(ProdBOM, itemName));
sysTableLookup.addLookupfield(fieldNum(ProdBOM, ProdLineType));
sysTableLookup.addLookupfield(fieldNum(ProdBOM, InventTransId));

sysTableLookup.performFormLookup();
}

在 Tables\ProdBOM\Methods\configId 中,您可以清楚地看到这段代码有问题。怎么回事??

//BP Deviation documented
display ConfigId configId()
{
ProdBOM pb;
;
select firstonly pb where pb.RecId == this.RecId;

info(strfmt("Bad: [%1, %2], Good:[%3, %4]", this.ItemId, this.InventDimId, pb.ItemId, pb.InventDimId));
return this.inventDim().ConfigId;
}

最佳答案

所以我想通了。在 Classes\SysTableLookup\buildSelectionList 中,它将查找字段中包含的所有字段添加到 QBDS.addSelectionField,这似乎将其从返回字段中删除??

虽然它没有去除 RecId,所以我能够创建另一种显示方法,使用 recId 重新选择记录。

//BP Deviation documented
display ConfigId configIdFromRecId()
{
return InventDim::find((select firstonly prodBOM where prodBOM.RecId == this.RecId).InventDimId).configId;
}

关于axapta - SysTableLookup 的查找方法错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17843756/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com