How to Find Unused Images in App Studio

Removing unused images is an easy way to increase app performance and reduce memory issues. Run the query below in SQL Server Management Studio on a database to determine which images are not being used in the app:

DECLARE @AppID INTEGER

SET @AppID = 1000

SELECT
R.AppID, R.ResourceID, R.ResourceIntID, R.ResourceName 
FROM
tmpcfg_Resource R
LEFT JOIN tmpapp_App A1 ON R.ResourceID = A1.ProductSelectedImageID
LEFT JOIN tmpapp_App A2 ON R.ResourceID = A2.ProductSelectedImageID
LEFT JOIN tmpapp_App A3 ON R.ResourceID = A3.ProductUnselectedImageID
LEFT JOIN tmpapp_App A4 ON R.ResourceID = A4.TitleImageID
LEFT JOIN tmpapp_App A5 ON R.ResourceID = A5.AppLogoImageID
LEFT JOIN tmpapp_App A6 ON R.ResourceID = A6.TopBannerImageID
LEFT JOIN tmpapp_App A7 ON R.ResourceID = A7.BottomGraphicImageID
LEFT JOIN tmpapp_App A8 ON R.ResourceID = A8.HomeScreenImageID
LEFT JOIN tmpapp_App A9 ON R.ResourceID = A9.NavBarBackgroundImageID
LEFT JOIN tmpapp_App A10 ON R.ResourceID = A10.NavBarImageID
LEFT JOIN tmpapp_App A11 ON R.ResourceID = A11.TitleBarBackgroundImageID
LEFT JOIN tmpapp_Entity E ON R.ResourceID = E.ClientImageID
LEFT JOIN tmpcfg_Choice CH ON R.ResourceID = CH.DisplayImageID
LEFT JOIN tmpcfg_Control C1 ON R.ResourceID = C1.DefaultImageID
LEFT JOIN tmpcfg_Control C2 ON R.ResourceID = C2.RollOverImageID
LEFT JOIN tmpcfg_GraphicalMenuItem GNB1 ON R.ResourceID = GNB1.SelectedImageID
LEFT JOIN tmpcfg_GraphicalMenuItem GNB2 ON R.ResourceID = GNB2.UnselectedImageID
LEFT JOIN tmpcfg_MenuCommand MC ON R.ResourceID = MC.MenuItemImageID
LEFT JOIN tmpcfg_MenuItem MI ON R.ResourceID = MI.MenuItemImageID
LEFT JOIN tmpcfg_Screen S1 ON R.ResourceID = S1.PortraitBackgroundImageID
LEFT JOIN tmpcfg_Screen S2 ON R.ResourceID = S2.LandscapeBackgroundImageID
LEFT JOIN tmpcfg_Screen S3 ON R.ResourceID = S3.MenuItemImageID
WHERE
A1.AppID IS NULL
AND A2.AppID IS NULL
AND A3.AppID IS NULL
AND A4.AppID IS NULL
AND A5.AppID IS NULL
AND A6.AppID IS NULL
AND A7.AppID IS NULL
AND A8.AppID IS NULL
AND A9.AppID IS NULL
AND A10.AppID IS NULL
AND A11.AppID IS NULL
AND E.EntityID IS NULL
AND CH.ChoiceID IS NULL
AND C1.ControlID IS NULL
AND C2.ControlID IS NULL
AND GNB1.GraphicalMenuItemID IS NULL
AND GNB2.GraphicalMenuItemID IS NULL
AND MC.CommandID IS NULL
AND MI.MenuItemID IS NULL
AND S1.ScreenID IS NULL
AND S2.ScreenID IS NULL
AND S3.ScreenID IS NULL
AND R.AppID = @AppID

 

The following file contains this query.                    

 FindUnusedImages.sql

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk