Quantcast
Channel: OpenPlant | AutoPLANT
Viewing all articles
Browse latest Browse all 12277

Wiki Page: Fundamentals of External Database Query in OpenPlant Modeler

$
0
0
Applies To Product(s): OpenPlant Modeler Version(s): 08.11.09.XXX (SS5) | 08.11.11.XX (SS6) Environment: Windows 7/8.1/10 (64 bit) Area: Properties Subarea: External Database Query Original Author: Harpreet Singh, Bentley Product Advantage Group Background This article explains the fundamentals of external database query in OpenPlant Modeler. Basically, it requires a new custom attribute in the schema which will help in pulling the values from external database (Access/SQL) through select statements. Steps to Accomplish Launch Class Editor and load OpenPlant_CustomAttributes.08.11 schema . This schema is located in C:\ProgramData\Bentley\OpenPlantModeler V8i\WorkSpace\OPModeler folder. Right click on the class node and click Add Class . Name the class as EXTERNAL_DATABASE_QUERY. Change “IsCustomAttributeClass” to True. Switch to properties tab and click ADD button to add new property. Name the property as CONFIG_VARIABLE_FOR_CONNECTION_STRING. Similarly add three more properties as shown below. Note: Change the Type to Boolean as highlighted above. SAVE the changes in this schema. How External Database Query Custom Attribute Works Sample custom attribute with values Config. Var. for Connection String: This contains the configuration variable defined in the project pcf. File, which holds the database connection information. Below is the example of added variable in PCF file. Default Value: This should be the string which user wants to appear as the property value, when its associated SQL query returns empty result. Which can be the case if the depended values in the where clause are invalid. Note: Default value cannot be blank. Pick First Entry from the List : It’s a boolean type property and defines the default behavior of the pick list selection. The explanations of its values are as follows. True: If set true, based on the query results on first launch or if any value change for the property it SQL query depends on, it will automatically select the first entry from the results and set it as the selected value. This will save the clicks on the user side when there is always 1 result to be selected like description etc. False: If set false. On first launch of ec data pan or, change in value of any ec property which is the part of its where clause. Its value will be reset to “Default Value”. And will force the user to select the right value from the drop down. That is to save the user from scenario of overlooking the wrong value selection. SQL Query: User can define the whole query, including, field to be queried, table name or view name, where clause and display order. All the field names in where clause should be encapsulated in the square brackets like [FIELD_NAME]. All the EC Property names which are the placeholder for their actual values should be encapsulated in double quotes and angle brackets. “ ”. Comments or Corrections? Bentley's Product Advantage Group requests that you please confine any comments you have on this Wiki entry to this "Comments or Corrections?" section. THANK YOU!

Viewing all articles
Browse latest Browse all 12277

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>