Acumatica:在同一DAC字段上切换选择器属性

Acumatica:在同一DAC字段上切换选择器属性,acumatica,Acumatica,你好 我的DAC中有一个字段,需要根据我在首选项上设置的设置更改选择器属性。您可能知道,acumatica上存在LeadSelector属性和CustomerSelector属性。如果我在首选项上设置Customer,我希望更改给定字段的selector属性,反之亦然 现在这里有可用的资源吗 我一直在考虑创建一个扩展选择器属性,在该属性上我将检查什么是首选项设置,然后在扩展选择器上继承LeadSelector或CustomerSelector。但我认为这可能是不可能的 我一直在想的另一件事是,在

你好

我的DAC中有一个字段,需要根据我在首选项上设置的设置更改选择器属性。您可能知道,acumatica上存在LeadSelector属性和CustomerSelector属性。如果我在首选项上设置Customer,我希望更改给定字段的selector属性,反之亦然

现在这里有可用的资源吗

我一直在考虑创建一个扩展选择器属性,在该属性上我将检查什么是首选项设置,然后在扩展选择器上继承LeadSelector或CustomerSelector。但我认为这可能是不可能的

我一直在想的另一件事是,在属性上添加两个选择器,并在设置首选项时将它们从图形级别删除

我还考虑创建两个选择器,根据首选项设置,我将在其上隐藏另一个选择器。但问题是,选择器不仅在一个页面上使用,如果我创建两个选择器只是为了解决这个问题,那将是一个麻烦。而且在未来,它可能不仅仅是领导者和客户选择者

我希望你能帮我,我没有主意了。非常感谢你

更新日期:2019年9月24日

我为Lead和Customer选择器属性创建了一个自定义选择器属性。现在我的问题是,描述字段不会显示在文本框或该字段上,还有错误,例如“系统中找不到投资者名称”

投资者选择器属性

public class InvestorSelectorAttribute : PXCustomSelectorAttribute
{

    public InvestorSelectorAttribute() : base(typeof(REInvestor.accountID))
    {
        DescriptionField = typeof(REInvestor.acctName);
        SubstituteKey = typeof(REInvestor.acctName);
    }

    protected IEnumerable GetRecords()
    {
        var leads = new PXSelect<Contact,
                        Where<Contact.contactType, Equal<ContactTypesAttribute.lead>,
                        Or<Where<Contact.contactType, Equal<ContactTypesAttribute.person>,
                            And<Contact.status, Equal<LeadStatusesAttribute.converted>>>>>>(this._Graph);

        var contacts = new PXSelect<BAccountR>(this._Graph);

        REFeature setup = PXSelect<REFeature>.Select(this._Graph);

        if (setup.InvestorType == InvestorTypesAttribute.LeadVal)
        {
            foreach (Contact lead in leads.Select())
            {
                yield return new REInvestor { AccountID = lead.ContactID, AcctName = lead.DisplayName };
            }
        }
        else
        {
            foreach (BAccountR contact in contacts.Select())
            {
                yield return new REInvestor { AccountID = contact.BAccountID, AcctName = contact.AcctName, AcctCD = contact.AcctCD };
            }
        }
    }
}

我真的需要你的帮助和建议。非常感谢。

可以定义两个字段并显示一个。 每个人都有自己的选择器和字段描述。 您可以基于图形级别的设置字段(行选定事件)为其中一个设置可见性

如果需要在持久化时合并它们(将两个字段持久化为一个绑定字段),只需使用两个未绑定字段来收集/显示数据

  • 在更新/持久化事件时,可以将未绑定字段中的值更新为唯一数据库字段

  • 在检索时,您可以进行数据视图委托,以根据配置填充未绑定的字段

当您计划在多个页面(图形)上移动时,将代码从图形移动到PXEventSubscriberAttribute 在DAC级别添加新属性。 这样,您就可以访问所有可能需要的图形事件(持久化、选择、更新等)。所有代码都保存在一个地方


对于多个DAC,仍然需要创建字段;为他们添加新属性。

谢谢您的建议。
[Serializable]
[PXCacheName("Investor")]
public class REInvestor : IBqlTable
{
    public abstract class accountID : BqlInt.Field<accountID> { }
    [PXDBInt(IsKey = true)]
    [PXUIField(DisplayName = REMessages.DisplayNames.AccountID, Visibility = PXUIVisibility.SelectorVisible)]
    public virtual int? AccountID { get; set; }

    public abstract class acctName : BqlString.Field<acctName> { }
    [PXDBString(128, InputMask = "", IsUnicode = true)]
    [PXUIField(DisplayName = REMessages.DisplayNames.AccountName, Visibility = PXUIVisibility.SelectorVisible)]
    public virtual string AcctName { get; set; }

    public abstract class acctCD : BqlString.Field<acctCD> { }
    [PXDBString(128, InputMask = "", IsUnicode = true)]
    [PXUIField(DisplayName = REMessages.DisplayNames.AcctCD, Visibility = PXUIVisibility.SelectorVisible)]
    public virtual string AcctCD { get; set; }
}
[PXDBInt]
    [PXUIField(DisplayName = REMessages.DisplayNames.InvestorsName, Required = true)]
    [InvestorSelector()]
    [PXDefault(PersistingCheck = PXPersistingCheck.NullOrBlank)]
    public virtual int? ContactID { get; set; }