-->

How to get values from PXselector

2019-08-28 01:38发布

问题:

Hello I am new in Acumatica development just want to ask how to get the data from pxselector when I select a row

here is my selector that i created

when I select one I only get the value for the atc.

BUT I ALSO NEED TO GET THE VALUE OF THE Taxrate and put the value on the next grid here WtaxPercent on select

here is my code for the pxselector

#region UsrATC
    [PXDBString(10)]
    [PXUIField(DisplayName="ATC")]
    [PXSelector(typeof(Search<withhildingtax.atc>),
                typeof(withhildingtax.Atcdescription),
                typeof(withhildingtax.Taxrate))]
    public virtual string UsrATC { get; set; }
    public abstract class usrATC : PX.Data.BQL.BqlString.Field<usrATC> { }
    #endregion

    #region UsrWTAXPercentage
    [PXDBDecimal]
    [PXUIField(DisplayName="WTaxPercentage")]

    public virtual Decimal? UsrWTAXPercentage { get; set; }
    public abstract class usrWTAXPercentage : PX.Data.BQL.BqlDecimal.Field<usrWTAXPercentage> { }
    #endregion

Thank you in advance for your help

回答1:

public class Test : IBqlTable
{
    #region UsrATC
    [PXDBString(10)]
    [PXUIField(DisplayName = "ATC")]
    [PXSelector(typeof(Search<withhildingtax.atc>),
                typeof(withhildingtax.Atcdescription),
                typeof(withhildingtax.Taxrate))]
    public virtual string UsrATC { get; set; }
    public abstract class usrATC : PX.Data.BQL.BqlString.Field<usrATC> { }
    #endregion

    #region UsrWTAXPercentage
    [PXDBDecimal]
    [PXUIField(DisplayName = "WTaxPercentage")]
    [PXDefault(typeof(Search<withhildingtax.Taxrate, Where<withhildingtax.atc, Equal<Current<Test.usrATC>>>>))]
    [PXSelector(typeof(Search<withhildingtax.Taxrate, Where<withhildingtax.atc, Equal<Current<Test.usrATC>>>>))]
    public virtual Decimal? UsrWTAXPercentage { get; set; }
    public abstract class usrWTAXPercentage : PX.Data.BQL.BqlDecimal.Field<usrWTAXPercentage> { }
    #endregion
}
public class TestGraph : PXGraph<TestGraph>
{
    protected virtual void Test_UsrATC_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
    {
        if (e.Row is Test row)
        {
            sender.SetDefaultExt<Test.usrWTAXPercentage>(e.Row);
        }
    }
}