I’m trying to select MatrixInventoryItem record inside a static process. I have the corresponding InventoryItem which I thought I could just cast as MatrixInventoryItem but was not able to.
I have this for my BQL:
MatrixInventoryItem matrixItem = PXSelect<MatrixInventoryItem,
Where<MatrixInventoryItem.inventoryID, Equal<Required<MatrixInventoryItem.inventoryID>>>>
.Select(itemGraph, item.InventoryID);
If I debug this I see that item.InventoryID does have a value.
In SQL profiler, I’m seeing this WHERE clause which returns no rows:
FROM [InventoryItem] [MatrixInventoryItem]
WHERE ( [MatrixInventoryItem].[CompanyID] = 2) AND [MatrixInventoryItem].[DeletedDatabaseRecord] = 0 AND (NULL = @P0) OPTION(OPTIMIZE FOR UNKNOWN)',N'@P0 int',@P0=675
But expecting this, which does return the row I need:
FROM [InventoryItem] [MatrixInventoryItem]
WHERE ( [MatrixInventoryItem].[CompanyID] = 2) AND [MatrixInventoryItem].[DeletedDatabaseRecord] = 0 AND ([MatrixInventoryItem].[InventoryID] = @P0) OPTION(OPTIMIZE FOR UNKNOWN)',N'@P0 int',@P0=675
What am I doing wrong?