External Database Query Setup
This example is being applied to OpenPlant PID schema but will work in OpenPlant Modeler as well.
User can define the whole query including, file to be queried, table name, whereclause, and display order. It should be a standard SQL query with the following exceptions.
- All the field names in the whereclause should be incapsulated in square brackets "[FIELD NAME]".
- All the EC Property names which are the placeholder for their actual values should be encapsulated in greater than and lesser than signs. '<EC PROPERTY NAME>'.
- The EC Property names and FIELD names are also case sensitive use uppercase in both.
In notepad this needs to be added to the
"EXTERNAL_DATSOURCE_DEFINITION_MAPPING" custom attribute:
<PROPERTY_MAPPING>
<UPDATE_DEFINITION_STRUCTURE>
<TABLE_FIELDNAME>
<ECPROPERTY>
</UPDATE_DEFINITION_STRUCTURE>
</PROPERTY_MAPPING>
Query Data from Excel Files
For an Excel query all the steps are the same except for the query statement. In Excel, you have to define the query in a way that Excel understands it and can access data from the sheets. "Data" as defined in the example below is the sheet name.
Connecting to SQL Server Databases using External Database Query
In order to connect to a SQL Server Database using the external database query, the connection string can be formed in the following ways:
Sample database using the Microsoft SQL Server Management Studio with the credentials as:

The name of my sample database is toTest as:

And on the schema end everything remains the same except for the part where we make the connection string and query the database, it becomes:

Adding an Extended Type that Reads and Displays a Database Table
To add the ability to read an external datasource (Access, SQL) and display results in a list view, to be used in a picklist.
The custom attribute would be defined on a property that would be picked in element info.
Connecting to Oracle Databases using External Database Query
In order to connect with an Oracle Database using External Database Query, firstly you must have Oracle Client installed on your machine, where the databases shall reside.
The connection string in the following case is formed as:
DATA SOURCE=Svrora12201:1521/orcl;DBA
PRIVILEGE=SYSDBA;USER ID=sys;PASSWORD=mgr
One can simply get this information from the properties of the database connection.

And in the class editor it becomes:









