🛠️Troubleshooting: "Used In" Error in Bepoz BackOffice
Error occurred in the BackOffice Program. `at 'Main Thread: backoffice.frmGridList: UsedInList_FillGrid'` **Index was outside the bounds of the array.**
If you see an error like the one below when editing a product in Bepoz BackOffice:

❗ Error Message:
**Bepoz Point of Sale**Error occurred in the BackOffice Program.`at 'Main Thread: backoffice.frmGridList: UsedInList_FillGrid'`**Index was outside the bounds of the array.**
✅ Fix: Run Cleanup SQL to Prevent the "Used In" Function from Crashing
This error is usually caused by orphaned rows in the `Ingredient` or `Condiment` tables.
You can fix it by running the following SQL commands on your database:
-- Backup current data
SELECT * INTO IngredientTemp2025 FROM Ingredient;
SELECT * INTO CondimentTemp2025 FROM Condiment;
-- Clean up orphaned data
DELETE FROM dbo.Ingredient
WHERE NOT EXISTS (
SELECT 1
FROM dbo.Product p
WHERE p.ProductID = dbo.Ingredient.BaseProductID
);
DELETE FROM dbo.Condiment
WHERE NOT EXISTS (
SELECT 1
FROM dbo.Product p
WHERE p.ProductID = dbo.Condiment.BaseProductID
);
💡 Always back up your database before performing deletions.