0

In Navision 2018, I have two tables contracts and fixed assets(FA) where each contract can have multiple FAs and a FA can be associated with multiple contracts. So I have a mapping table where the mapping between Contracts and FA are stored. In my FA asset Card I Need to Show 'number of contracts' associated with an FA, that I have already done. But now the Problem is I Need to Show the contract list on drill down of the 'Number of contracts' field which I have no idea how to do? Thank you in advance

4

1 回答 1

1

您需要将代码添加到“合同数量”字段的 OnDrillDown 触发器(可以在每个特定页面或表格上完成)。

代码应首先根据当前固定资产编号对合同记录进行正确过滤,然后运行合同列表页面,将过滤后的合同记录作为表格视图。

像这样的东西不是一个完整的例子,但应该指向正确的方向:

// "No." will be taken from Rec which will be your current Fixed Asset.
Contract.SETRANGE("Fixed Asset No.","No.");
ContractListPage.SETTABLEVIEW(Contract);
ContractListPage.RUN;

有关更多信息,请查看SETTABLEVIEW 函数

为了解决多对多关系的挑战,您需要首先找到需要在联系人列表中显示的所有合同,然后构建所需的过滤器值:

ContractFixedAssets.SETRANGE("Fixed Asset No.","No.");

IF ContractFixedAssets.FIND('+') THEN BEGIN
    IF FilterValue <> '' THEN
        FilterValue += '|';

    FilterValue += ContractFixedAssets."Contract No.";
END;

Contract.SETFILTER("No.",'%1',FilterValue);
于 2019-09-11T12:10:50.480 回答