我有一个选择器,它从一个表中进行选择,该表中有一些记录具有相同的 CD 字段用作所选值,但 ID 不同。例如,我有两条记录,表中数据如下:
当选择器弹出时,显示以下内容:
这是选择器代码:
public abstract class clientEINID : PX.Data.BQL.BqlInt.Field<clientEINID>{ }
[PXDBInt()]
[PXDefault()]
[PXUIField(DisplayName = "Client FEIN")]
[PXSelector(typeof(Search<xTACEntityMappingEIN.iD, Where<xTACEntityMappingEIN.taxDeptUse, Equal<True>, And<xTACEntityMappingEIN.active, Equal<True>>>>)
, typeof(xTACEntityMappingEIN.eIN)
, typeof(xTACEntityMappingEIN.commonName)
, typeof(xTACEntityMappingEIN.entityType)
, SubstituteKey = typeof(xTACEntityMappingEIN.eIN))]
public virtual int? ClientEINID { get; set; }
问题是,无论我从选择器中选择哪条记录,返回的ID都是565,或者是返回结果中的第一项。就好像,由于两个 CD(EIN 字段)相同,因此它没有将我想要的记录的实际 ID 值与返回的内容关联起来。如何让选择器返回选择器中第二个选择的正确 ID(ID 为 566 的那个)?
将 SubstituteKey 语句更改为以下内容,看看是否会改变行为
DescriptionField = typeof(xTACEntityMappingEIN.eIN))]