Skip to main content
Solved

Extending InventoryItem DAC with field from another DAC


Forum|alt.badge.img

In the  code I’m trying to Extend InventoryItem DAC to include the AlternateID from INItemXRef

 I created a customization project, and added the required code, the new field showing in the InventoryItem fields,
Code:
 

  public class InventoryItemExt : PXCacheExtension<InventoryItem>
    {
        #region CustomAlternateID
        [PXString(50, IsUnicode = true)]
        [PXUIField(DisplayName = "GTIN/EAN/UPC/ISBN")]
        [PXSelector(
            typeof(Search<INItemXRef.alternateID,
                          Where<INItemXRef.inventoryID, Equal<Current<InventoryItem.inventoryID>>,
                                And<INItemXRef.alternateType, Equal<INAlternateType.gIN>>>>),
            typeof(INItemXRef.alternateID),
            SubstituteKey = typeof(INItemXRef.alternateID))]
        public virtual string CustomAlternateID { get; set; }
        public abstract class customAlternateID : PX.Data.BQL.BqlString.Field<customAlternateID> { }
        #endregion
    }

But it always return empty when I use it in the GI or view in screen

 

 

Hope if someone can advise on what is missing in the code , thanks in advance

Best answer by Django

I suspect that you want to use a PXDBScalar attribute which will be translated to a SQL sub-select.

View original
Did this topic help you find an answer to your question?

4 replies

Forum|alt.badge.img+6
  • Captain II
  • 560 replies
  • Answer
  • January 3, 2025

I suspect that you want to use a PXDBScalar attribute which will be translated to a SQL sub-select.


Forum|alt.badge.img
  • Author
  • Varsity III
  • 39 replies
  • January 3, 2025

@Django this works thanks, using PXDBScalar allows the values to be shown, than you.

 

I’ve anothe quesiton, now the value appear but when using the quick filter on the top right of the table in my screenshot it’s not filtering using the this field. any idea?


Forum|alt.badge.img+6
  • Captain II
  • 560 replies
  • January 3, 2025

There’s a column within the GI Editor on the Results Grid tab called Use in Quick Search. Show that column and then fill in the check box for you column. That should do it.

 


Forum|alt.badge.img
  • Author
  • Varsity III
  • 39 replies
  • January 4, 2025

 ​@Django 

Thanks so much , this works!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings