继承投影DAC网格过滤失效:多部分标识符绑定失败求助
解决继承投影DAC网格过滤报错问题
问题根源
报错“无法绑定多部分标识符‘FAAccrualTranCst.PONbr’”的核心原因:
- 投影查询未将
APTran纳入可访问的DAC集合,系统生成过滤SQL时无法关联到APTran.PONbr字段 - 原关联条件未明确指定DAC归属的字段,存在SQL解析歧义风险
修复方案
方案1:更新投影属性与关联条件
直接调整PXProjection的配置,将APTran加入投影包含的DAC列表,同时修正关联条件的字段歧义:
[Serializable] [PXProjection(typeof(Select2<GLTran, LeftJoin<FAAccrualTran, On<GLTran.tranID, Equal<FAAccrualTran.tranID>>, LeftJoin<APTran, On<GLTran.refNbr, Equal<APTran.refNbr>, And<GLTran.tranType, Equal<APTran.tranType>, And<GLTran.branchID, Equal<APTran.branchID>>>>>>>, Where<GLTran.module, NotEqual<BatchModule.moduleFA>, And<GLTran.released, Equal<True>>>>), new Type[] { typeof(FAAccrualTran), typeof(APTran) })] [PXSubstitute(GraphType = typeof(AssetGLTransactions))] public partial class FAAccrualTranCst : FAAccrualTran { public abstract class pONbr : PX.Data.IBqlField { } [PXDBString(25, IsUnicode = true, InputMask = ">aaaaaaaaaa", BqlField = typeof(APTran.pONbr))] [PXUIField(DisplayName = "PONbr")] public virtual string PONbr { get; set; } }
方案2:使用PXDBScalar显式映射字段
如果方案1仍存在过滤问题,可改用PXDBScalar通过子查询明确获取APTran.PONbr的值,避免关联表的解析问题:
[Serializable] [PXProjection(typeof(Select2<GLTran, LeftJoin<FAAccrualTran, On<GLTran.tranID, Equal<FAAccrualTran.tranID>>>, Where<GLTran.module, NotEqual<BatchModule.moduleFA>, And<GLTran.released, Equal<True>>>>), new Type[] { typeof(FAAccrualTran) })] [PXSubstitute(GraphType = typeof(AssetGLTransactions))] public partial class FAAccrualTranCst : FAAccrualTran { public abstract class pONbr : PX.Data.IBqlField { } [PXDBScalar(typeof(Select<APTran.pONbr, Where<APTran.refNbr, Equal<GLTran.refNbr>, And<APTran.tranType, Equal<GLTran.tranType>, And<APTran.branchID, Equal<GLTran.branchID>>>>>))] [PXUIField(DisplayName = "PONbr")] public virtual string PONbr { get; set; } }
验证
修复后重新发布项目,即可正常使用PONbr字段的网格过滤功能,同时保留原有排序功能。
内容的提问来源于stack exchange,提问作者Adam Rezende
相关产品推荐
相关产品推荐

