获取图外的当前缓存
Get current cache outside of graph
我创建了一个自定义选择器,其逻辑取决于屏幕 header 部分中字段的值。由于逻辑不在包含视图的图表中,我将如何获取此 header 部分的缓存的当前值?我已将我在 header 中引用的字段设置为 commitchanges=true,我什至将 SyncPosition=true 放在页面的 header 部分。以下逻辑没有给我缓存中(我假设)的当前值:
mh = (xTACMappingHeader)PXSelect< xTACMappingHeader,
Where< xTACMappingHeader.mappingName, Equal<Required<xTACMappingDetail.mappingName>>>>.Select(new PXGraph<FinancialTranslatorMaint>(), md.MappingName);
在该图之外的图中检索缓存当前值的最佳方法是什么?
谢谢...
PXCache 对象从不存在于图形之外。您可以通过 PXCustomSelectorAttribute 的 _Graph 字段访问当前图形:
protected PXGraph _Graph;
类似于:
mh = (xTACMappingHeader)PXSelect<…>.Select(_Graph, md.MappingName);
访问缓存的当前值:
_Graph.Caches[typeof(YourDAC)].Current
在初始化缓存时,Acumatica Framework 会为每个字段属性调用 CacheAttached() 方法。 PXCustomSelectorAttribute 根据当前正在初始化的 PXCache 对象的 Graph 属性 为 _Graph 字段赋值:
public class PXCustomSelectorAttribute : PXSelectorAttribute
{
...
public override void CacheAttached(PXCache sender)
{
...
_Graph = sender.Graph;
...
}
...
}
您使用 CacheAttached 事件获取图表。请参阅下面的示例。
public class YourAttribute : PXEventSubscriberAttribute
{
private PXGraph _Graph = null;
public override void CacheAttached(PXCache sender)
{
_Graph = sender.Graph;
base.CacheAttached(sender);
}
}
我创建了一个自定义选择器,其逻辑取决于屏幕 header 部分中字段的值。由于逻辑不在包含视图的图表中,我将如何获取此 header 部分的缓存的当前值?我已将我在 header 中引用的字段设置为 commitchanges=true,我什至将 SyncPosition=true 放在页面的 header 部分。以下逻辑没有给我缓存中(我假设)的当前值:
mh = (xTACMappingHeader)PXSelect< xTACMappingHeader,
Where< xTACMappingHeader.mappingName, Equal<Required<xTACMappingDetail.mappingName>>>>.Select(new PXGraph<FinancialTranslatorMaint>(), md.MappingName);
在该图之外的图中检索缓存当前值的最佳方法是什么?
谢谢...
PXCache 对象从不存在于图形之外。您可以通过 PXCustomSelectorAttribute 的 _Graph 字段访问当前图形:
protected PXGraph _Graph;
类似于:
mh = (xTACMappingHeader)PXSelect<…>.Select(_Graph, md.MappingName);
访问缓存的当前值:
_Graph.Caches[typeof(YourDAC)].Current
在初始化缓存时,Acumatica Framework 会为每个字段属性调用 CacheAttached() 方法。 PXCustomSelectorAttribute 根据当前正在初始化的 PXCache 对象的 Graph 属性 为 _Graph 字段赋值:
public class PXCustomSelectorAttribute : PXSelectorAttribute
{
...
public override void CacheAttached(PXCache sender)
{
...
_Graph = sender.Graph;
...
}
...
}
您使用 CacheAttached 事件获取图表。请参阅下面的示例。
public class YourAttribute : PXEventSubscriberAttribute
{
private PXGraph _Graph = null;
public override void CacheAttached(PXCache sender)
{
_Graph = sender.Graph;
base.CacheAttached(sender);
}
}