关于acumatica,有没有办法从一个table中获取一个变量并将其用作另一个table的id的一部分?
In relation to acumatica, is there a way to grab a variable from one table and use it as part of an id for another table?
'Customer' 表单有一个名为 AcctReferenceNbr (Variable that I'm trying to grab shown in yellow) 的变量,它采用客户名称的两个字母缩写。我目前正在编辑项目表格,我想使用这个缩写作为外部参考的一部分。 Nbr.
所附图片 End Result I'm trying to achieve 显示了最终结果的样子。来自 QuoteID 的数字附加到缩写。
我能够成功获取 QuoteID,因为它是项目 table 的一部分,但我目前无法从客户 table.
获取 AcctReference Nbr
我在 QuoteID 字段上有一个 RowSelected 事件,如下所示:
namespace PX.Objects.PM
{
public class ProjectEntry_Extension : PXGraphExtension<ProjectEntry>
{
#region Event Handlers
protected void PMProject_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
{
PMProject row = (PMProject)e.Row;
if (row.ContractCD != null) {
PMProject item = PXSelectorAttribute.Select<PMProject.contractCD>(cache, row) as PMProject;
// The "UP" string is where the abbreviation is supposed to be,
// but I just added two letters to test if the appending works, which it does.
row.ExtRefNbr = "UP" + item.ContractCD;
}
}
#endregion
}
}
到目前为止我尝试过的:
访问 Customer table 命名空间以获取值并将其传递给 Projects 表单,这不起作用,因为它不接受 Projects 表单中的 Customer 类型。
正在向外部引用添加 PXDefault 属性。 Nbr 会尝试使用 SQL.
获取变量
我对我还能尝试的其他方法有点困惑。任何帮助将不胜感激:)
已更新
下面是我如何尝试从客户那里获取 AcctReferenceNbr 值 table。
我尝试使用 PXSelectorAttribute 方法的原因是我将 AcctReferenceNbr 作为列添加到报价 ID 选择器(选择器显示在上面的 link 中,称为“我试图实现的最终结果” ').
所以我想我可以尝试在 Customer 命名空间中获取该值,因为这是变量所在的位置,并将其向上传递到上面的 Project 命名空间。
然后,我会在 Project 命名空间中调用下面的 public 方法来获取所需的缩写:
// instead of this
row.ExtRefNbr = "UP" + item.ContractCD;
// it would be this
row.ExtRefNbr = PX.Objects.AR.CustomerMaint_Extension.getAcctReferenceNbr(cache, e) + item.ContractCD;
namespace PX.Objects.AR
{
public class CustomerMaint_Extension : PXGraphExtension<CustomerMaint>
{
#region Event Handlers
public static string getAcctReferenceNbr(PXCache cache, PXRowSelectedEventArgs e)
{
BAccount row = (BAccount)e.Row;
BAccount item = PXSelectorAttribute.Select<BAccount.acctReferenceNbr>(cache, row) as BAccount;
return item.acctReferenceNbr;
}
}
#endregion
}
}
是否有正确的方法来定位实际 table?
试试这个。我还没有测试过这个,但试一试。
protected void PMProject_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
{
PMProject row = (PMProject)e.Row;
if (row.ContractCD != null && row.CustomerID != null)
{
BAccount ba = (BAccount )PXSelectorAttribute.Select<PMProject.customerID>(cache, row) ;
row.ExtRefNbr = ba.AcctReferenceNbr+ row.ContractCD;
}
}
您当然不需要扩展 CustomerMaint 图。
'Customer' 表单有一个名为 AcctReferenceNbr (Variable that I'm trying to grab shown in yellow) 的变量,它采用客户名称的两个字母缩写。我目前正在编辑项目表格,我想使用这个缩写作为外部参考的一部分。 Nbr.
所附图片 End Result I'm trying to achieve 显示了最终结果的样子。来自 QuoteID 的数字附加到缩写。
我能够成功获取 QuoteID,因为它是项目 table 的一部分,但我目前无法从客户 table.
获取 AcctReference Nbr我在 QuoteID 字段上有一个 RowSelected 事件,如下所示:
namespace PX.Objects.PM
{
public class ProjectEntry_Extension : PXGraphExtension<ProjectEntry>
{
#region Event Handlers
protected void PMProject_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
{
PMProject row = (PMProject)e.Row;
if (row.ContractCD != null) {
PMProject item = PXSelectorAttribute.Select<PMProject.contractCD>(cache, row) as PMProject;
// The "UP" string is where the abbreviation is supposed to be,
// but I just added two letters to test if the appending works, which it does.
row.ExtRefNbr = "UP" + item.ContractCD;
}
}
#endregion
}
}
到目前为止我尝试过的:
访问 Customer table 命名空间以获取值并将其传递给 Projects 表单,这不起作用,因为它不接受 Projects 表单中的 Customer 类型。
正在向外部引用添加 PXDefault 属性。 Nbr 会尝试使用 SQL.
获取变量
我对我还能尝试的其他方法有点困惑。任何帮助将不胜感激:)
已更新
下面是我如何尝试从客户那里获取 AcctReferenceNbr 值 table。
我尝试使用 PXSelectorAttribute 方法的原因是我将 AcctReferenceNbr 作为列添加到报价 ID 选择器(选择器显示在上面的 link 中,称为“我试图实现的最终结果” ').
所以我想我可以尝试在 Customer 命名空间中获取该值,因为这是变量所在的位置,并将其向上传递到上面的 Project 命名空间。
然后,我会在 Project 命名空间中调用下面的 public 方法来获取所需的缩写:
// instead of this
row.ExtRefNbr = "UP" + item.ContractCD;
// it would be this
row.ExtRefNbr = PX.Objects.AR.CustomerMaint_Extension.getAcctReferenceNbr(cache, e) + item.ContractCD;
namespace PX.Objects.AR
{
public class CustomerMaint_Extension : PXGraphExtension<CustomerMaint>
{
#region Event Handlers
public static string getAcctReferenceNbr(PXCache cache, PXRowSelectedEventArgs e)
{
BAccount row = (BAccount)e.Row;
BAccount item = PXSelectorAttribute.Select<BAccount.acctReferenceNbr>(cache, row) as BAccount;
return item.acctReferenceNbr;
}
}
#endregion
}
}
是否有正确的方法来定位实际 table?
试试这个。我还没有测试过这个,但试一试。
protected void PMProject_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
{
PMProject row = (PMProject)e.Row;
if (row.ContractCD != null && row.CustomerID != null)
{
BAccount ba = (BAccount )PXSelectorAttribute.Select<PMProject.customerID>(cache, row) ;
row.ExtRefNbr = ba.AcctReferenceNbr+ row.ContractCD;
}
}
您当然不需要扩展 CustomerMaint 图。