Adding or Removing Indexed Fields
Indexed fields are used to optimize searching the database. They are defined as a constraint on the related column in the database table.
Adding an Indexed Field
To add an indexed field to an existing database table:
1. Navigate to the appropriate manager for the ThingWorx entity that is related to the database table. These managers are specified in the ManagerConfigurationSettings table on the Configuration page of the launch point configuration Thing (PTC.Factory.C_LaunchPointConfigurationThing_[ReleaseVersion]). For example, the manager for the Operator Advisor entities is the PTC.SCA.SCO.DefaultProductionOrderManager.
2. Under Services, find and override the Get<entity>DBInfo service for the entity to which you are adding the indexed field. For example, to add an indexed field to the database table for job orders, find and override the GetJobOrderDBInfo service.
3. In the script editor, scroll down to the entry for the Data Shape to which you want to add the indexed field.
4. Add an indexedFields array for the Data Shape, with the following properties:
name—(Required) Name of the column.
unique—Specify if the column must have a unique value.
identifier—The name of the entity in the database. If not specified, then the system automatically generates the value in the format <table_name>_<column_name>_idx. If specified, then the value must be unique for both specified values and any automatically generated values. The maximum length for the value is the maximum length allowed by the database for identifiers.
5. Click Save to save the changes to the service.
6. Navigate to the PTC.SCA.SCO.DatabaseManager Thing.
7. Synchronize the database information in Operator Advisor with the database schema. For more information, see Synchronizing the Database Information and the Database Schema.
Removing an Indexed Field
To remove an indexed field:
* 
Do not remove any indexed fields that are defined out-of-the-box. Remove only indexed fields that you have previously added, for example by Adding Custom Properties to Operator Advisor Entities or Adding Custom Entities to the Operator Advisor Data Model.
1. Navigate to the database Thing configured for your system, for example, PTC.SCA.SCO.PostgresDatabase or PTC.SCA.SCO.MSSQLDatabase.
2. Under Services, execute the RemoveIndex service with the following inputs:
dataShapeName—The Data Shape for the database table from which you are removing the indexed field constraint.
fieldName—The field on the Data Shape from which you are removing the indexed field constraint.
dbInfo—The JSON description of the indexed field constraint to be removed. The same identifier (if any) and name information that is specified in the Get<entity>DBInfo service where the indexed field is defined must be provided.
3. Click Execute.
4. Navigate to the Get<entity>DBInfo service where the indexed field is defined, and remove the indexed field definition from the services. If this is not removed, then the indexed field is added back to the database the next time the synchronization services are run.
For example, to remove an indexed field constraint with a specified identifier from a field named WorkDefinitionUID on the MyObject Data Shape, specify the following for the input parameters:
dataShapeNameMyObject
fieldNameWorkDefinitionUID
dbInfo
{
"identifier":"myobject_workdefinitionuid_idx"
"name":"WorkDefinitionUID",
}
Was this helpful?