Home / eaDocX Homepage / EaDocX Help / eaDocX Script examples / Hard coded GUIDs
Table of contents
Hard coded GUIDs
Table of contents
Notes
- The name of the function is not important. Just so long as the main function name gets called by the code at the bottom
- Get some GUIDs from EA, and paste them into the script
- Create a JavaScript using the EA Specialize / Scripting / Script library
- We suggest making a new ‘Normal’ group of scripts in EA, so all your eaDocX scripts stay in one place.
function Blocks() { // Tell eaDocX that this is an eaDocX Script //<Type>eaDocX</Type> //Shows how to do an independent test using the EA script debugger and static data //This code can be used for stand-alone testing // copy/paste some guids from your model into here, so the script can be used in the EA script debugger elementGuids = "{95B69752-65FB-460e-AFEF-4576327665D2},{27C0B884-098E-4538-AC40-266FE9F42C18}"; var guids = elementGuids.split(","); Â // Create a string to hold the HTML var outputHTML = ""; outputHTML += "<p>This script uses fixed GUIDS, built-in to the code</p>\r\n"; // Start the table outputHTML += "<table border='2' style='border-collapse: collapse'>\r\n"; // Add the table header outputHTML += "<tr><strong><td width=200>Name</td><td width=200>Notes</td><td width=100>Author</td></strong></tr>"; // Loop through each GUID for (var i = 0; i < guids.length; i++) { // Get the EA.Element by GUID var theElement = Repository.GetElementByGuid(guids); if (theElement !== null) { // Add a row for the element outputHTML += "<tr>"; outputHTML += "<td>" + theElement.Name + "</td>"; outputHTML += "<td>" + theElement.Notes + "</td>"; outputHTML += "<td>" + theElement.Author + "</td>"; outputHTML += "</tr>"; } else { // Element not found; skip or log if needed } } // Complete the HTML outputHTML += "</table>\r\n"; return outputHTML; } // Call the function result = Blocks();