TM Master Common Errors

Error when opening Inventory -> Spare parts

Error when opening Inventory -> Spare parts

The error message below is caused by a bug in the currently installed version of V2 where it doesn't handle double currency codes.


This can be fixed in the office by doing the following:


Go in to Administration - Currency.

Find any duplicate currency codes

Rename one of them to something else and then delete it.

This will replicate to all the vessels as well.


The reason you have to rename it before deleting it is because in some versions it doesn't help if they're just Rowdeleted = 1 in the database. It will still crash as long as this code already exists.


If the above process doesn't help, you will also need to do the following:


If there any duplicates already deleted these will need to be completely deleted from the database. This can be done with the following SQL:


delete from tmcurrencyexchange where rowdeleted = 1


Note that this SQL will completely delete all currency exchanges that have been set to rowdeleted (deleted from V2). This will also need to be run on each vessel as delete-sql's do not replicate.


This issue is fixed in the latest patch.


Error message:

SELECT TmItemUnit.ChangedFields, TmItemUnit.TmItemUnitID, TmItemUnit.TmUnitID, TmItemUnit.TmItemID, TmItemUnit.MinQty, TmItemUnit.MaxQty, TmItemUnit.Price, TmItemUnit.Currency, TmItemUnit.OnOrder, TmItemUnit.DefaultStockLocationID, TmItemUnit.EstimatedDeliveryDays, TmItemUnit.InStock, TmItemUnit.SupplierID, TmItemUnit.SupplierRef, TmItemUnit.OnDraft, TmItemUnit.PriceChangedDate, TmItemUnit.ReviewMinMax, TmItem.ChangedFields, TmItem.TmItemID, TmItem.TmItemGroupID, TmItem.Name, TmItem.ItemType, TmItem.MakersPartNo, TmItem.Maker, TmItem.UOM, TmItem.StockTag, TmItem.CatalogNo, TmItem.CatalogName, TmItem.CatalogSpecification, TmItem.Specification, TmItem.ImageFileRef, TmItem.Validated, TmItem.Weight, TmItem.MakersType, TmItem.IMPANo, TmItem.ISSANo, TmItem.CatalogPrice, TmItem.CatalogCurrency, TmItem.InactiveCatalogItem, TmItem.SparepartNumber, TmItem.OldSparepartNumber, TmItem.ItemCategoryCode, TmItem.HSCode, TmItem.HSDescription, TmItem.ControlledGoods, TmItem.isGreen, TmCompany.Name AS Supplier ,

COALESCE(TmCurrencyExchange.Exchange/TmCurrencyExchange.UnitOfExchange,1.0) /

COALESCE(UnitCurrency.Exchange/UnitCurrency.UnitOfExchange,1.0) AS ExchangeRate,

Str(COALESCE(

COALESCE(TmItemUnit.Price,0.0) *

(COALESCE(TmCurrencyExchange.Exchange/TmCurrencyExchange.UnitOfExchange,1.0) /

COALESCE(UnitCurrency.Exchange/UnitCurrency.UnitOfExchange,1.0)), 0.0),10,2) + ' ' + UnitCurrency.CurrencyCode AS PriceInUnitCurrency

FROM TmItem With (NoLock)

INNER JOIN TmItemUnit With (NoLock) ON TmItem.TmItemID = TmItemUnit.TmItemID AND TmItemUnit.TmUnitID = '77b018d5-0557-44ac-8d52-cd21a410312c' And TmItemUnit.RowDeleted = 0

LEFT OUTER JOIN TmCompany With (NoLock) ON TmItemUnit.SupplierID = TmCompany.TmCompanyID

LEFT OUTER JOIN TmUnit With (NoLock) ON TmItemUnit.TmUnitID = TmUnit.TmUnitID

LEFT OUTER JOIN TmCurrencyExchange With (NoLock) ON TmItemUnit.Currency = TmCurrencyExchange.CurrencyCode

LEFT OUTER JOIN (SELECT TmUnit.TmUnitID, Exchange, TmUnit.CurrencyCode,UnitOfExchange FROM TmUnit, TmCurrencyExchange With (NoLock) WHERE TmUnit.CurrencyCode = TmCurrencyExchange.CurrencyCode) AS UnitCurrency on UnitCurrency.TmUnitID = TmUnit.TmUnitID

WHERE (TmItem.RowDeleted = 0) AND (TmItem.ItemType = 'sp')



Infotech.Data.DataComponents.DataCompException: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints. ---> System.Data.ConstraintException: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article