首页 > 解决方案 > PXSubordinateSelector 使用 Where

问题描述

我需要有关如何将 PXSubordinateSelector 属性与您可以在属性上设置的 Where 类型一起使用的信息。有人知道如何使用这个属性吗?

具体来说,如果可能,我需要通过 EPCompanyTree 表中的自定义字段过滤选择器。不确定此选择器属性使用哪些表。它似乎被塞进了 Acumatica 黑匣子。像这样的东西:

 [PXSubordinateSelector(typeof(Where<EPCompanyTree.customField, Equal<{somevalue}>>))]

我尝试在 EPCompanyTree.sortorder 字段上将 Where 设置为任意过滤器,但是在单击查找时出现“未绑定”错误。

蒂亚!

标签: acumatica

解决方案


这个错误的原因是GetCommandPXSubordinateSelectorAttribute. 下面是该方法的反汇编代码:

    private static Type GetCommand(Type where)
    {
        Type whereType = typeof(Where<CREmployee.userID, Equal<Current<AccessInfo.userID>>, Or<EPCompanyTreeMember.workGroupID, Owned<Current<AccessInfo.userID>>>>);
        if (where != null)
        {
            whereType = BqlCommand.Compose(new Type[]
            {
                typeof(Where2<, >),
                typeof(Where<CREmployee.userID, Equal<Current<AccessInfo.userID>>, Or<EPCompanyTreeMember.workGroupID, Owned<Current<AccessInfo.userID>>>>),
                typeof(And<>),
                where
            });
        }
        return BqlCommand.Compose(new Type[]
        {
            typeof(Search5<, , , >),
            typeof(CREmployee.bAccountID),
            typeof(LeftJoin<EPCompanyTreeMember, On<EPCompanyTreeMember.userID, Equal<CREmployee.userID>>>),
            whereType,
            typeof(Aggregate<GroupBy<CREmployee.acctCD>>)
        });
    }

正如您从代码中看到的那样,搜索正在组织中CREmployee左连接EPCompanyTreeMember,同时,您的代码正在尝试在EPCompanyTree不参与搜索的字段上添加条件。


推荐阅读