我已将客户位置添加到全文实体索引中,但无法弄清楚如何从该位置获取地址行1 全文索引并显示在结果中。
答案 0 :(得分:1)
要包含链接实体的字段(与数据输入屏幕上的与顶级实体一对一的关系的字段),需要指定哪个顶级实体字段应与PXSelectorAttribute一起使用以检索链接的实体。在作为链接实体之间桥梁的顶级实体字段之后,您将指定辅助实体的字段,这些字段应包含在全文索引中和/或显示在结果中。请记住,只有使用PXSelectorAttribute或PXDimensionSelectorAttribute修饰的顶级实体字段才能充当链接实体之间的桥梁。
例如,要将地址 DAC中的字段包含在客户位置全文实体索引中,您必须添加 DefAddressID 字段在列出地址 DAC中的字段之前,从位置 DAC:
public partial class Location : PX.Data.IBqlTable, IPaymentTypeDetailMaster, ILocation
{
...
public abstract class defAddressID : IBqlField { }
[PXDBInt()]
[PXDBChildIdentity(typeof(Address.addressID))]
[PXUIField(DisplayName = "Default Address", Visibility = PXUIVisibility.Invisible)]
[PXSelector(typeof(Search<Address.addressID>), DirtyRead = true)]
public virtual int? DefAddressID { get; set; }
...
}
以下代码段中的 CustomerLocation DAC可以作为用于将客户位置添加到全文实体索引的自定义DAC的完美示例:< / p>
[Serializable]
[PXCacheName("Customer Location")]
[PXBreakInheritance]
public partial class CustomerLocation : SelectedCustomerLocation
{
public new abstract class bAccountID : IBqlField { }
[Customer(typeof(Search<Customer.bAccountID,
Where<Customer.type, Equal<BAccountType.customerType>,
Or<Customer.type, Equal<BAccountType.prospectType>,
Or<Customer.type, Equal<BAccountType.combinedType>>>>>),
IsKey = true)]
public override int? BAccountID { get; set; }
public new abstract class locationCD : IBqlField { }
public new abstract class descr : IBqlField { }
public new abstract class defAddressID : IBqlField { }
public new abstract class locType : IBqlField { }
public new abstract class noteID : IBqlField { }
[PXNote()]
[PXSearchable(SM.SearchCategory.CR, "{1} {2}: {3}",
new Type[] {
typeof(CustomerLocation.bAccountID),
typeof(Customer.acctCD),
typeof(CustomerLocation.locationCD),
typeof(CustomerLocation.descr) },
new Type[] {
typeof(CustomerLocation.bAccountID),
typeof(Customer.acctCD),
typeof(CustomerLocation.locationCD),
typeof(CustomerLocation.descr),
typeof(CustomerLocation.defAddressID),
typeof(Address.addressLine1),
typeof(Address.addressLine2),
typeof(Address.city),
typeof(Address.countryID) },
Line1Format = "{0} {2}",
Line1Fields = new Type[] {
typeof(CustomerLocation.descr),
typeof(CustomerLocation.defAddressID),
typeof(Address.addressLine1) },
Line2Format = "{1}",
Line2Fields = new Type[] {
typeof(CustomerLocation.defAddressID),
typeof(Address.addressLine2) },
WhereConstraint =
typeof(Where<CustomerLocation.locType, Equal<LocTypeList.customerLoc>,
Or<CustomerLocation.locType, Equal<LocTypeList.combinedLoc>>>),
MatchWithJoin = typeof(InnerJoin<Customer,
On<Customer.bAccountID, Equal<CustomerLocation.bAccountID>>>),
SelectForFastIndexing = typeof(Select2<CustomerLocation,
InnerJoin<Customer,
On<CustomerLocation.bAccountID, Equal<Customer.bAccountID>>>>)
)]
public override Guid? NoteID { get; set; }
}
使用 DefAddressID 字段,该字段用于包含地址 DAC到全文实体索引的字段, CustomerLocation 也可以使用附加到 BAccountID 字段的 CustomerAttribute 包含客户的自然应用程序 AcctCD 键,而不是代理数据库级别 BAccountID 键。最后要提到的是 PXBreakInheritanceAttribute ,以防止在重建全文实体索引屏幕时初始化与基本DAC相对应的PXCache对象时系统生成要使用的实体列表通过全文实体索引。