0
votes

Good Day Sir / Ma'am,

Forgive me for asking this question if ever this question was already raised in the community, but I can't seem to find the right answer to my problem.

I have an extended graph which contains 2 custom views, which is the ReservationDetails and PropertyItems.

GRAPH

    public class SOOrderEntryExt : PXGraphExtension<SOOrderEntry>
    {
            #region Selects

            public PXSelect<RECOReservationDetail,
                                Where<RECOReservationDetail.reservationNbr,
                                    Equal<Current<SOOrder.orderNbr>>>> ReservationDetails;


            public PXSelectReadonly<InventoryItem,
                                Where<InventoryItem.inventoryID,
                                    Equal<Current<RECOReservationDetail.inventoryID>>>> PropertyItems;
            #endregion
    }

DAC

[Serializable]
    public class RECOReservationDetail : IBqlTable
    {

        #region Reservation Nbr.

        [PXDBString(15, IsKey = true)]
        [PXUIField(DisplayName = "Reservation Nbr.")]
        [PXDefault()]
        public virtual string ReservationNbr { get; set; }
        public abstract class reservationNbr : IBqlField { }

        #endregion

        #region Branch ID

        [PXDBInt]
        [PXSelector(typeof(Search<Branch.branchID>),
                    SubstituteKey = typeof(Branch.branchCD))]
        [PXUIField(DisplayName = "Branch ID", Required = true)]
        [PXDefault(typeof(AccessInfo.branchID), PersistingCheck = PXPersistingCheck.Nothing)]
        public virtual int? BranchID { get; set; }
        public abstract class branchID : IBqlField { }

        #endregion

        #region Inventory ID

        [StockItem]
        [PXUIField(DisplayName = "Inventory ID", Required = true)]
        public virtual int? InventoryID { get; set; }
        public abstract class inventoryID : IBqlField { }

        #endregion

        #region Salesperson ID

        [PXDBInt]
        [PXDefault(PersistingCheck = PXPersistingCheck.Nothing)]
        [PXUIField(DisplayName = "Salesperson ID")]
        [PXSelector(typeof(Search<SalesPerson.salesPersonID>),
                    SubstituteKey = typeof(SalesPerson.salesPersonCD))]
        public virtual int? SalespersonID { get; set; }
        public abstract class salespersonID : IBqlField { }

        #endregion

        #region Quantity

        [PXDBDecimal(2)]
        [PXUIField(DisplayName = "Quantity", Enabled = false)]
        [PXDefault(TypeCode.Decimal, "1.0", PersistingCheck = PXPersistingCheck.Nothing)]
        public virtual decimal? ItemQty { get; set; }
        public abstract class itemQty : IBqlField { }

        #endregion

        #region Reservation Fee

        [PXDBDecimal(2)]
        [PXUIField(DisplayName = "Reservation Fee")]
        [PXDefault(TypeCode.Decimal, "0.0", PersistingCheck = PXPersistingCheck.Nothing)]
        public virtual decimal? ReservationFee { get; set; }
        public abstract class reservationFee : IBqlField { }

        #endregion

        #region Reservation Cash Disc.

        [PXDBDecimal(2)]
        [PXUIField(DisplayName = "Reservation Cash Disc.")]
        [PXDefault(TypeCode.Decimal, "0.0", PersistingCheck = PXPersistingCheck.Nothing)]
        public virtual decimal? ReservationCashDiscAmt { get; set; }
        public abstract class reservationCashDiscAmt : IBqlField { }

        #endregion

        #region Amount

        [PXDBDecimal(2)]
        [PXUIField(DisplayName = "Amount")]
        [PXDefault(TypeCode.Decimal, "0.0", PersistingCheck = PXPersistingCheck.Nothing)]
        public virtual decimal? ReservationAmt { get; set; }
        public abstract class reservationAmt : IBqlField { }

        #endregion

        #region Product Type
        [PXDBString(15)]
        [PXDefault(ProductTypes.Lot, PersistingCheck = PXPersistingCheck.Nothing)]
        [PXStringList(
            new string[] {
                ProductTypes.HouseConstruction,
                ProductTypes.HouseLot,
                ProductTypes.HouseLotAdjacentLot,
                ProductTypes.Lot
            },
            new string[] {
                "House Construction",
                "House & Lot",
                "House & Lot with Adjacent Lot",
                "Lot"
            })]
        [PXUIField(DisplayName = "Product Type")]
        public virtual string ProductType { get; set; }
        public abstract class productType : IBqlField { }
        #endregion
    }

Now, the problem arises when I'm trying to change the Inventory ID in my page, It clears the values of all the control on the page.

BEFORE I change the Inventory ID

AFTER I changed the Inventory ID

The record on the controls are being cleared every time I changed the inventory id.

I just don't understand where I have made a mistake on extending the graph.

Thank you and I hope you can help me with this problem.

UPDATE - 10/01/2018

This is the whole layout for the page. I have inputted the order nbr / reservation nbr, but the inventory id at the detail section still clears everything whenever i try filling it out.

I also tried replacing the inventory id control on the page, but it still not solved the issue.

FINAL UPDATE

I finally fixed the issue. I don't know why but after I put a PxParent attribute on my reservation nbr, it solved the clearing issue on the child tabs. Thank you so much for all the help. Happy Coding!

#region Reservation Nbr.

        [PXDBString(15, IsKey = true)]
        [PXUIField(DisplayName = "Reservation Nbr.")]
        [PXParent(typeof(Select<SOOrder, 
                            Where<SOOrder.orderNbr, 
                                Equal<Current<RECOReservationDetail.reservationNbr>>>>))]
        [PXDBDefault(typeof(SOOrder.orderNbr))]
        public virtual string ReservationNbr { get; set; }
        public abstract class reservationNbr : IBqlField { }

#endregion
1
I don't see the key field being filled into the record? Where is ReservationNbr and its value? If its based on the sales order number you need to make sure you add a default value of the sales order number for the ReservationNbr field. As you have it above its just empty and not shown on the field so the key of the row will never get filled in. - Brendan
Hello @Brendan, Thank you for the suggestion. I tried the thing that you said by putting the reservation nbr / sales order number, but to no avail, whenever i inputted the inventory id, it clears everything on the child tab. I uploaded the image above for more reference. Thank you so much for the reply. - Linnaire
Hello @Brendan, I finally got the answer to my question. Thank you so much for the suggestion and reply. :) - Linnaire

1 Answers

0
votes

I solved the issue by adding a PXParent attribute on the ReservationNbr in my DAC. Though I don't understand why it worked. (^_^)

    #region Reservation Nbr.

    [PXDBString(15, IsKey = true)]
    [PXUIField(DisplayName = "Reservation Nbr.")]
    [PXParent(typeof(Select<SOOrder, 
                        Where<SOOrder.orderNbr, 
                            Equal<Current<RECOReservationDetail.reservationNbr>>>>))]
    [PXDBDefault(typeof(SOOrder.orderNbr))]
    public virtual string ReservationNbr { get; set; }
    public abstract class reservationNbr : IBqlField { }

    #endregion

Thank you so much for all the help. Happy Coding! :)