Skip to main content
Solved

Iventory levels differ in GI vs SQL query

  • December 7, 2024
  • 2 replies
  • 35 views

estebanperalta54
Captain II
Forum|alt.badge.img+4

Hi! has anyone experienced this where for the same item if you create a GI with table INLocationStatus it returns a qty on hand different than querying for the same table using SSMS. I’m not doing any joins or anything complex. Simply selecting Inventory ID, Qty on hand from INLocationStatus:

 

Best answer by lauraj46

HI ​@estebanperalta54 ,

From the DAC Schema Browser you can view the DAC Source Code.  You also click on DAC Query to view the SQL query that Acumatica uses to retrieve the data.  

Here is the DAC region:

#region QtyOnHand
        public abstract class qtyOnHand : PX.Data.BQL.BqlDecimal.Field<qtyOnHand> { }
        protected Decimal? _QtyOnHand;
        [PXDBQuantity(BqlField = typeof(INLocationStatusByCostCenter.qtyOnHand))]
        [PXDefault(TypeCode.Decimal,"0.0")]
        [PXUIField(DisplayName="Qty. On Hand")]
        public virtual Decimal? QtyOnHand
        {
            get
            {
                return this._QtyOnHand;
            }
            set
            {
                this._QtyOnHand = value;
            }
        }
        #endregion

And here is the SQL query:

SELECT
  [INLocationStatus_INLocationStatusByCostCenter].[InventoryID] AS [InventoryID],
  [INLocationStatus_INLocationStatusByCostCenter].[QtyOnHand] AS [QtyOnHand] 

  ...
FROM
  [INLocationStatusByCostCenter] [INLocationStatus_INLocationStatusByCostCenter]
WHERE
  ([INLocationStatus_INLocationStatusByCostCenter].[CostCenterID] = 0)

Based on this you can see tha tINLocationStatus is actually a projection of INLocationStatusByCostCenter in the underlying database.

Hope this helps!

Laura

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

2 replies

lauraj46
Captain II
Forum|alt.badge.img+8
  • Captain II
  • 606 replies
  • Answer
  • December 9, 2024

HI ​@estebanperalta54 ,

From the DAC Schema Browser you can view the DAC Source Code.  You also click on DAC Query to view the SQL query that Acumatica uses to retrieve the data.  

Here is the DAC region:

#region QtyOnHand
        public abstract class qtyOnHand : PX.Data.BQL.BqlDecimal.Field<qtyOnHand> { }
        protected Decimal? _QtyOnHand;
        [PXDBQuantity(BqlField = typeof(INLocationStatusByCostCenter.qtyOnHand))]
        [PXDefault(TypeCode.Decimal,"0.0")]
        [PXUIField(DisplayName="Qty. On Hand")]
        public virtual Decimal? QtyOnHand
        {
            get
            {
                return this._QtyOnHand;
            }
            set
            {
                this._QtyOnHand = value;
            }
        }
        #endregion

And here is the SQL query:

SELECT
  [INLocationStatus_INLocationStatusByCostCenter].[InventoryID] AS [InventoryID],
  [INLocationStatus_INLocationStatusByCostCenter].[QtyOnHand] AS [QtyOnHand] 

  ...
FROM
  [INLocationStatusByCostCenter] [INLocationStatus_INLocationStatusByCostCenter]
WHERE
  ([INLocationStatus_INLocationStatusByCostCenter].[CostCenterID] = 0)

Based on this you can see tha tINLocationStatus is actually a projection of INLocationStatusByCostCenter in the underlying database.

Hope this helps!

Laura


estebanperalta54
Captain II
Forum|alt.badge.img+4

Thanks! ​@lauraj46 


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