Issue
Creating many TGML graphics that use the same or similar links and bindings can be difficult and time consuming.
Environment
- TGML
- Vista Workstation
Cause
The copy and paste feature does not work on more than one link at a time.
Resolution
Whenever a Vista database export is performed on a group of TGML graphics, a .zip file is created that contains a source TGML file for each selected graphic, and one XML file describing all of the links and bindings contained in the database for those graphics. By editing this XML document and leveraging find/replace capabilities of text editors, the process of manually populating links and bindings can be sped up substantially.
Warning: Always back up your database before performing any manipulation of XML files. There is a potential for your graphics to be ruined if a mistake is made, so be sure a current backup is available in this event. This is an advanced operation and should only be attempted by individuals with an understanding of Vista TGML graphics.
This example shows how to populate the links on a standard menu that appears on every TGML graphic in a database. For simplicity, the database has three graphics: AHU1, AHU2, and AHU3. But the steps can be applied to hundreds of graphics just the same.
-
A menu is created in TGML with a link to each graphic. The links are named AHU1, AHU2, and AHU3. These will correspond with the TGML objects in Vista that are also named AHU1, AHU2, and AHU3. The names do not have to match, but it is a good design standard to follow whenever possible.
- Right-click on the first graphic and choose Open Links Window. The first graphic should be populated manually to give a template for the rest. Populate each link using the traditional drag-and-drop. Verify the links are populated correctly.
-
Go to File > Database > Export.... Select "Get a customized copy of the database.
This is the only option that needs to be selected. - Highlight all of the graphics and drag them into the Export window. Click the green arrow in the upper-lefthand corner of the Export window and give the .zip file a name. Click Save. A message will appear stating "Vista Database Export completed"
- Find the resulting .zip file in the location specified in Step 4. Right-click and extract all files. Depending on the operating system and software, this step may vary. Unzip the specified file.
- In the resulting folder, find VistaDbImportExport.xml. Right click and open with Notepad or other text editor.
- Find Objects of type "TGML_LINK." If the RELREFID is populated, then this link has a destination. If it says RELREFID="" then this link is not yet populated.
-
Time for some strategic find/replace. In this example, AHU1 has all of the links populated. But AHU2 does not. There are three links on each page that all share the same destination.
Find the populated entry for AHU1 links:
Object TYPE="TGML_LINK" NAME="AHU1.AHU1" DESCR="" SHCP="" SHCR="" IOLABEL="" RA="" WA="" KEYLABEL="" RELREFID="Graphics-AHU1" _PROTECTED="0"
Find the non-populated entry for AHU1 links:
Object TYPE="TGML_LINK" NAME="AHU2.AHU1" DESCR="" SHCP="" SHCR="" IOLABEL="" RA="" WA="" KEYLABEL="" RELREFID="" _PROTECTED="0"
-
Select everything after the graphic name that is not unique and perform a find replace:
Find:
AHU1" DESCR="" SHCP="" SHCR="" IOLABEL="" RA="" WA="" KEYLABEL="" RELREFID=""
Replace:
AHU1" DESCR="" SHCP="" SHCR="" IOLABEL="" RA="" WA="" KEYLABEL="" RELREFID="Graphics-AHU1"
- Repeat this action for AHU2 and AHU3.
- When all of the edits have been made to the XML document, save and close it.
- Highlight the XML document as well as all of the TGML files in the unzipped folder. Right click and select Send to > Compressed (zipped) folder. This will create a modified database export file.
- In Workstation, go to File > Database > Import. Browse to the .zip file created in Step 12. De-select Perform alarm refresh and hit OK. A message will be displayed that says "Vista Database Import completed.
- All of the links on every page are now populated.