Imported Assets with No Application Item ID
- Last UpdatedFeb 20, 2023
- 1 minute read
This script lists the external assets imported with blank application item ID in the database. The assets with blank application item ID may cause issues when importing the assets.
Resolution:
Execute the following SQL command. This script will update the Application Item ID to AssetName~TypeOfAsset for each external asset under the specified organization. For more information about Tenant, Organization,and Plant, see the help in AVEVA Mobile Operator web application.
DECLARE @OrganizationName nvarchar(100), @OrganizationId uniqueidentifier
SET @OrganizationName = N'< Provide Organization Name for which Asset data need to be fixed. >'
IF @OrganizationName = '' OR @OrganizationName = N'< Provide Organization Name for which Asset data need to be fixed. >'
BEGIN
PRINT 'OrganizationName is required.'
RETURN
END
SELECT @OrganizationId = BASE_PK FROM ISMGT_BASE WHERE Name = @OrganizationName
IF @OrganizationId IS NULL or @OrganizationId = ''
BEGIN
PRINT 'Organization does not exists.'
RETURN
END
UPDATE SAT_Assets SET Application_Item_ID = a.AssetName + '~' + a.TypeOfAsset
FROM SAT_Assets a
WHERE a.AssetPK = AssetPK
AND a.OrganizationEntityFK = @OrganizationId
AND a.Application_ID != '4175FCBD-46F6-404C-A864-324A6D61650E'
AND
(
a.Application_Item_ID IS NULL
OR
a.Application_Item_ID = ''
)