acumatica - 通用属性搜索
问题描述
我正在尝试搜索存储在我的属性下的值。
例如,我在“案例”屏幕下有一些属性。我想从通用搜索中搜索这些属性的值。因此,当我进行通用搜索时,它会提出这种情况。
我知道我们可以包含PXSearchable
在注释中。但是由于属性存储在 CSAnswers 表中,我不确定如何包含它。此外,CSAnswers 不可用于重建索引屏幕 (SM209500)
我有下面的代码,它不工作。
public class CRCaseMaint_Extension : PXGraphExtension<CRCaseMaint>
{
#region PXNotes
[PXNote()]
[PXSearchable(SM.SearchCategory.CR, "{0}", new Type[] { typeof(CRCase.caseCD) }, new Type[] { typeof(CSAnswers.value) },
Line1Format = "{0}{1}", Line1Fields = new Type[] { typeof(CRCase.caseCD),typeof(CRCase.subject) }
)]
public Guid? NoteID { get; set; }
#endregion
}
任何建议。
解决方案
我在 InventoryItem 上使用 DAC 扩展中的未绑定字段执行此操作,以应用 PXDBScalar 来检索值,然后将该字段合并到 [PXNote] 中。PXDBScalar 允许您根据当前 DAC 中的某个值从另一个 DAC 中查找一个值。我对此有点挣扎,因为我想在 Where 子句中使用 Current,但在这种情况下不使用 Current<>。此示例中的 PXDBScalar 将为我的 InventoryItem 查找我的 AttributeID“SITEM”的 CSAnswer 属性值。
为了获取特定的 AttributeID,我定义了一个带有特定 AttributeID 的 PX.Data.BQL.BqlString.Constant 以供 PXDBScalar 引用,因为它在使用 PXDBScalar 时需要一个类型。
public sealed class InventoryItemExt : PXCacheExtension<PX.Objects.IN.InventoryItem>
{
#region SItem
[PXString]
[PXUIField(DisplayName = "S Item")]
[PXDBScalar(typeof(Search<CSAnswers.value,
Where<CSAnswers.refNoteID, Equal<InventoryItem.noteID>,
And<CSAnswers.attributeID, Equal<AttribSItem>>>>))]
public string SItem { get; set; }
public abstract class sItem : PX.Data.BQL.BqlString.Field<sItem> { }
#endregion
public class AttribSItem : PX.Data.BQL.BqlString.Constant<AttribSItem>
{
public AttribSItem() : base("SITEM") { }
}
}
在 NoteID 的 PXSearchable 属性中,我添加了对上面我的 PXString 字段的引用。
#region NoteID
[PXSearchable(SearchCategory.IN, "{0}: {1}",
new Type[] { typeof(InventoryItem.itemType), typeof(InventoryItem.inventoryCD) },
new Type[] { typeof(InventoryItem.descr), typeof(InventoryItem.body), typeof(InventoryItemExt.sItem) },
NumberFields = new Type[] { typeof(InventoryItem.inventoryCD) },
Line1Format = "{0}{1}", Line1Fields = new Type[] { typeof(INItemClass.itemClassCD), typeof(InventoryItem.baseUnit) },
Line2Format = "{0} {1}", Line2Fields = new Type[] { typeof(InventoryItem.descr), typeof(InventoryItemExt.sItem) },
WhereConstraint = typeof(Where<Current<InventoryItem.itemStatus>, NotEqual<InventoryItemStatus.unknown>>)
)]
[PXNote]
public Guid? NoteID { get; set; }
#endregion
推荐阅读
- java - 在 Java 中,什么是比 stream().forEach() 更有效但仍使用流操作的方法?
- google-cloud-platform - 无法从所有角色中包含服务帐户的计算引擎访问 bigquery
- swift - 复制和粘贴时如何阻止Textview也复制格式?
- wso2 - WSO2 API Manager SSL/TLS 证书安装
- flutter - 如何在 table_calendar 上获取多天事件
- c - 如何比较文件中的字符串和标准输入字符串
- php - 在引导编辑表中保存选定的选项值
- javascript - 使用单选按钮计算
- python - 使用 Parser 从 Span 中提取内联数据
- mysql - 将未定义变量输入 SQL 数据库的节点函数