Creating dropdown list to assign a value to a DEVICE_TYPE_CODE property based on a database query

Add EXTERNAL_DATSOURCE_DEFINITION_MAPPING and ExtendType custom attributes to DEVICE_TYPE_CODE property

Enter ShowPickListviewDataBase in ExtendType attribute's name field

Description of EXTERNAL_DATSOURCE_DEFINITION_MAPPING custom attribute.

Data connection string:

Provider=SQLOLEDB;Data Source=Your_Server_Name;Initial Catalog= Your_Database_Name;User Id=Your_Username;Password=Your_Password;

Sql Select statement:

SQL query to create the list

Property Mapping:

To map database fields with the EC Properties


Right click on property mapping and select “Add element”


ECProperty name:

The name of the EC property

Table Field name:

The name of the field in the database table


Below is example of custom attribute added to property. Screenshot and XML text:


<ECProperty propertyName="DEVICE_TYPE_CODE" typeName="string" description="code uses to describe the type of component." displayLabel="Device Type Code">            <ECCustomAttributes>                    <EXTERNAL_DATSOURCE_DEFINITION_MAPPING xmlns="pid.01.03">                    <DATA_CONNECTION_STRING>Provider=SQLOLEDB;Data Source=SSQL2008;Initial Catalog=myDataBase;User Id=sa;Password=q1w2e3;</DATA_CONNECTION_STRING>                    <FILENAME xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />                    <PATH_LOCATION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />                    <SQL_SELECT>SELECT DISTINCT * FROM LIST</SQL_SELECT>                    <PROPERTY_MAPPING>                        <UPDATE_DEFINITION_STRUCTURE>                            <TABLE_FIELDNAME>LIST</TABLE_FIELDNAME>                            <ECPROPERTY>DEVICE_TYPE_CODE</ECPROPERTY>                        </UPDATE_DEFINITION_STRUCTURE>                    </PROPERTY_MAPPING>                </EXTERNAL_DATSOURCE_DEFINITION_MAPPING>                <ExtendType xmlns="EditorCustomAttributes.01.00">                    <Name>ShowPickListviewDataBase</Name>                </ExtendType>            </ECCustomAttributes>        </ECProperty>    </ECClass>

As a result drop down list should be shown in Placement Dialog 





 

Anonymous