Acumatica-使用不同字段的值填充字段
我试图将屏幕上的其他字段串在一起,有些是usr字段。我在跟踪中得到一个输出,但在我的例子中它只是null或破折号。即使破折号仍然被输出,它也不会更新到我希望字符串存储的字段。 这是我的密码:Acumatica-使用不同字段的值填充字段,acumatica,Acumatica,我试图将屏幕上的其他字段串在一起,有些是usr字段。我在跟踪中得到一个输出,但在我的例子中它只是null或破折号。即使破折号仍然被输出,它也不会更新到我希望字符串存储的字段。 这是我的密码: protected void InventoryItem_Descr_FieldDefaulting(PXCache cache, PXFieldDefaultingEventArgs e) { var row = (InventoryItem)e.Row; Combine
protected void InventoryItem_Descr_FieldDefaulting(PXCache cache, PXFieldDefaultingEventArgs e)
{
var row = (InventoryItem)e.Row;
Combined.StockItem.InventoryItemExt rowExt = PXCache<InventoryItem>.GetExtension<Combined.StockItem.InventoryItemExt>(row);
if (row == null) return;
if (row != null) {
string style = row.ItemClassID;
string metalColor = rowExt.UsrMetalColor;
string metalType = rowExt.UsrMetalType;
string diaQuality = rowExt.UsrDiamondQuality;
string gemColor = rowExt.UsrCenterColor;
string template = "{0}-{1}-{2}-{3}-{4}";
string message = string.Format(template, style, metalColor, metalType, diaQuality, gemColor);
PXTrace.WriteInformation("{0}", message);
e.NewValue = message;
}
}
我正在提取的值确实具有存储在数据库中的值,但我希望在输入字段时动态生成这些值
我也尝试了e.NewValue
,cache.SetValueExt
,并通过row.Descr=message
使其等于message,以使字符串显示为该字段的值
任何输入都会有帮助。将您的代码放在RowUpdate事件下,这应该对您有用
protected void InventoryItem_RowUpdated(PXCache cache, PXRowUpdatedEventArgs e, PXRowUpdated InvokeBaseHandler)
{
if (InvokeBaseHandler != null)
InvokeBaseHandler(cache, e);
var row = (InventoryItem)e.Row;
Combined.StockItem.InventoryItemExt rowExt = PXCache<InventoryItem>.GetExtension<Combined.StockItem.InventoryItemExt>(row);
if (row == null) return;
if (row != null) {
string style = row.ItemClassID;
string metalColor = rowExt.UsrMetalColor;
string metalType = rowExt.UsrMetalType;
string diaQuality = rowExt.UsrDiamondQuality;
string gemColor = rowExt.UsrCenterColor;
string template = "{0}-{1}-{2}-{3}-{4}";
string message = string.Format(template, style, metalColor, metalType, diaQuality, gemColor);
PXTrace.WriteInformation("{0}", message);
cache.SetValueExt<InventoryItem.descr>(row, message);
}
}
protected void inventory item_RowUpdated(PXCache缓存、PXRowUpdatedEventArgs e、PXRowUpdated InvokeBaseHandler)
{
if(InvokeBaseHandler!=null)
InvokeBaseHandler(缓存,e);
var行=(InventoryItem)e.row;
Combined.StockItem.InventoryItemExt rowExt=PXCache.GetExtension(行);
if(row==null)返回;
如果(行!=null){
字符串样式=row.itemsclassid;
字符串metalColor=rowExt.UsrMetalColor;
字符串metalType=rowExt.UsrMetalType;
字符串diaQuality=rowExt.UsrDiamondQuality;
字符串gemColor=rowExt.UsrCenterColor;
字符串模板=“{0}-{1}-{2}-{3}-{4}”;
string message=string.Format(模板、样式、metalColor、metalType、diaQuality、gemColor);
PXTrace.WriteInformation(“{0}”,消息);
cache.SetValueExt(行,消息);
}
}
您的扩展似乎返回了,但没有任何值?你确认了吗?这样做的目的是在创建新项目时自动设置说明吗?如果是这样,您可以将代码添加到已更新的InventoryID(或CD)字段中,以查看这是否有影响。您的FieldDefaulting事件处理程序在您的usr字段获取其值之前工作。尝试在RowUpdated事件句柄中执行相同的逻辑在哪个窗体上有这种奇怪的行为?对现有问题的另一个要求是,如何在每个值之后换行(通过将文本属性更改为多行模式)。Row Updated确实起到了回答的作用。
protected void InventoryItem_RowUpdated(PXCache cache, PXRowUpdatedEventArgs e, PXRowUpdated InvokeBaseHandler)
{
if (InvokeBaseHandler != null)
InvokeBaseHandler(cache, e);
var row = (InventoryItem)e.Row;
Combined.StockItem.InventoryItemExt rowExt = PXCache<InventoryItem>.GetExtension<Combined.StockItem.InventoryItemExt>(row);
if (row == null) return;
if (row != null) {
string style = row.ItemClassID;
string metalColor = rowExt.UsrMetalColor;
string metalType = rowExt.UsrMetalType;
string diaQuality = rowExt.UsrDiamondQuality;
string gemColor = rowExt.UsrCenterColor;
string template = "{0}-{1}-{2}-{3}-{4}";
string message = string.Format(template, style, metalColor, metalType, diaQuality, gemColor);
PXTrace.WriteInformation("{0}", message);
cache.SetValueExt<InventoryItem.descr>(row, message);
}
}