In the following BQL Fluent statement, I am selecting a record from the POVendorInventory table.
In the table, the record has a NULL in the SubItemID field. When there is a NULL in that field, this returns no record even though my parameter “reg.SubItemID’ is passing a NULL.
That field is part of a unique index. My select statement is making sure that if a record already exists with the key fields, it does not add a duplicate.
POVendorInventory test = SelectFrom<POVendorInventory>
.Where<POVendorInventory.vendorID.IsEqual<@P.AsInt>
.And<POVendorInventory.inventoryID.IsEqual<@P.AsInt>>
.And<POVendorInventory.purchaseUnit.IsEqual<@P.AsString>>
.And<POVendorInventory.vendorLocationID.IsEqual<@P.AsInt>>
.And<POVendorInventory.subItemID.IsEqual<@P.AsInt>>>
.View.Select(graph, bAccountTo.BAccountID, reg.InventoryID, reg.PurchaseUnit, locationIDToUse, reg.SubItemID);
In debug, test is null.
If I do a select statement in SQL on the table using those parameter values, it retrieves the record.
SELECT * FROM POVendorInventory
WHERE
VendorID = 7117
AND InventoryID = 10102
AND VendorLocationID = 8161
AND PurchaseUnit = 'LS'
AND SubItemID IS NULL
If I edit the table and put in an actual integer in the SubItemID field and pass it as the SubItemID parameter, I am able to retrieve the record in my BQL statement.
In my select statement, is there something I need to add to it in the case that the field is NULL?
Best answer by davidnavasardyan09
View original