Skip to main content

Hello,

I have a DAC MyCustomer that has Customer reference BAccountID. In a graph for another DAC MyPartnership I want to use a Selector to pick a MyCustomer and also shows the AcctCD by using an unbound column. 

The selector itself works fine, but I get errors for persisting MyPartnership or loading existing ones.

The error in Trace is this.

Invalid column name ''MyCustomerExt]..acctCD]'

 

Please note, that MyCustomer is not an Extension and I have no idea why it is looking for MyCustomerExt.

 

Here is my code:

    public class MyCustomer : IBqlTable
    {
        #region BAccountID
        ICustomer(IsKey = true)]
        PXDefault]
        public virtual int? BAccountID { get; set; }
        public abstract class bAccountID : PX.Data.BQL.BqlInt.Field<bAccountID> { }
        #endregion

        #region AcctCD
        nPXDBScalar(typeof(Search<BAccount.acctCD, Where<BAccount.bAccountID, Equal<MyCustomer.bAccountID>>>))]
        public virtual string AcctCD { get; set; }
        public abstract class acctCD : PX.Data.BQL.BqlString.Field<acctCD> { }
        #endregion

    }

 

    public class MyPartnership: IBqlTable
    {
        #region BAccountID
        uPXDBInt(IsKey = true)]
        bPXSelector(typeof(Search<MyCustomer.acctCD>),
            SubstituteKey = typeof(MyCustomer.acctCD))]
        rPXUIField(DisplayName = "Customer Account")]
        public virtual int? BAccountID { get; set; }
        public abstract class bAccountID : PX.Data.BQL.BqlString.Field<bAccountID> { }
        #endregion

 

How can solve this? 

Hi @mhaps 

I see some issues in DAC field declarations. Please find the screenshot for reference.

 

 

 

As above DACs are custom DAC file, I recommend you to change field names (like instead of BAccountID,AcctCD, you can have CustomerID/CustomerName).

DBScaler attibute will be used for only Unbound fields. I have bit modified above DAC fields, please find DACs and comments below.

 

 public class MyCustomer : IBqlTable
{
#region BAccountID
Customer(IsKey = true)]
PXDefault]
public virtual int? BAccountID { get; set; }
public abstract class bAccountID : PX.Data.BQL.BqlInt.Field<bAccountID> { }
#endregion

#region AcctCD

PXString(255, IsUnicode = true)] // Added this line
PXDBScalar(typeof(Search<BAccount.acctCD, Where<BAccount.bAccountID, Equal<MyCustomer.bAccountID>>>))]
public virtual string AcctCD { get; set; }
public abstract class acctCD : PX.Data.BQL.BqlString.Field<acctCD> { }
#endregion

}



public class MyPartnership : IBqlTable
{
#region BAccountID
PXDBInt(IsKey = true)]
// Also, I see the issue with this selector, because you are searching for AcctCD(strig field in MyCustomer) for the BAccountID(which is integer in MyPartnership DAC)
PXSelector(typeof(Search<MyCustomer.acctCD>), SubstituteKey = typeof(MyCustomer.acctCD))]
PXUIField(DisplayName = "Customer Account")]
public virtual int? BAccountID { get; set; }
public abstract class bAccountID : PX.Data.BQL.BqlInt.Field<bAccountID> { }
#endregion
}

 

Hope this helps!!


Thanks @Naveen B for the quick response.

And sorry for mixing Int and String in the Selector. Should be

Search<MyCustomer.bAccountID>

I added the ePXString] to MyCustomer.AcctCD then changed the names as suggested.

Unfortunately this does not help. I get same error with new name still looking in MyCustomerExt.

Any more ideas?


I have also tried to use a join in the PXSelector to get the AcctCD directy from BAccount. That leeds to the same error. The error is gone when I omit the SubstituteKey.


Yeah..it is an issue with the Substitute key because the substitute key always looks for the bound field but in above it was an unbound field, hence you got that issue.


Reply