Sometimes performing a simple calculation, such as appending two text strings or finding a substring, on a property already in the POD file is required for reporting or other purposes. You can do this with an SQL statement in the GED script.
The following example shows how to append the first two characters of COMPONENT-ATTRIBUTE1 to PIPING-SPEC. To begin, you need to use a Microsoft Access database with a table that you can reference in the SQL query. This allows you to use the functions available in Microsoft Access as SQL extensions. For more information, see the documentation delivered with Microsoft Access.
The query you run must return a minimum of one row. The easiest way to achieve this is with the TOP 1 qualifier, as shown in the following example:
When the GED script runs, the SQL statement extracts the left two characters from COMPONENT-ATTRIBUTE1 and adds them, separated by a dash ( - ), to the component PIPING-SPEC. The result, the field A1, is then copied into the COMPONENT-ATTRIBUTE2 field.
You can use the EXECUTE element to check for the type of component. However, the EXECUTE element is omitted from the above example for clarity.