The Purge Unused Variables tool finds variables that are not used anywhere in the project and lets you remove them in one action. Open it with the Purge Unused Variables button in the left menu of the Envision editor, or with the Purge Unused Variables button in the Cross Reference tool. The tool is available to members of the Administrators user group.
Finding unused variables
Select Find Unused to scan the project. Every variable is checked against the places where a variable can be referenced, and a variable counts as used when it appears in any of them:
- Page content, covering the settings of the graphic objects on every page, including the symbols opened by popup actions
- Alarm and event conditions, messages, and actions
- Converters, Python scripts, schedules, and the global script parameter
- Report Designer reports, covering the period variables, the KPI tile bindings, the chart series, the historian table variables, the computed columns, and the summary aggregates of the report template
- Recipes, when the variable has both Recipe Targets and a Recipe Parameter Name configured
- Trends, when the variable is a member of a trend group
- Kafka, when the variable is assigned to a Kafka device
- UDT definitions, including references that still contain parameter tokens and only become a variable name when the instance is pushed
System variables and the built-in device status variables are excluded from the scan, and so are the rows that another feature owns: a variable materialized by a UDT instance is removed through the UDT Manager, and an element of a variable array is removed through its parent variable.
A variable array is represented in the list by its parent variable, which is the first element. Because deleting the parent deletes the whole array, the parent is reported as unused only when every element of the array is unused as well. Use the Filter field to narrow the result list to the variables you want to review.
Purging
Select the variables you want to remove and select Purge. Each selected variable is deleted from its protocol table and the affected devices are reloaded. The result list shows the outcome per variable.
Rows that are owned by another feature are protected and reported instead of deleted. A variable that is materialized by a UDT instance is managed through the UDT Manager; detach the instance first if you want to remove it. An element of a variable array is managed through its parent variable.
Purging an array parent removes its element rows together with it, so the whole array is checked again at the moment of the purge. When an element turns out to be in use, the parent is reported with the element that still references it and the array is kept. Ungroup the array first if you want to remove part of it.