Customizing Information Content > Managing Contexts
Managing Contexts
A context is a grouping of Assets (or equipment types that derive from Assets) in an equipment structure. ThingWorx Apps provides the ability to implement multiple contexts, each with its own equipment structure. Each context can have its own set of equipment relationships and permissions. Certain areas in ThingWorx Apps are context aware, meaning that only equipment in the currently selected context displays: Asset Advisor, Production KPIs, Alert Monitoring, and the Equipment tab in Configuration and Setup. From the Equipment tab, equipment is created, configured, and its equipment structure is managed by context.
In ThingWorx Apps, users with permissions on a context can access that context, while users with permissions on multiple contexts can switch between contexts. Within a context, users can access the equipment for which they have appropriate permissions. For more information, see Managing Context and Equipment Permissions.
Contexts are defined within ThingWorx Composer, on the EquipmentContextSettings configuration table of the launch point configuration thing (PTC.Factory.C_LaunchPointConfigurationThing_[ReleaseVersion]). By default, this table includes the default context (DefaultContext) provided with ThingWorx Apps. In the ThingWorx Apps user interface, the default context name is displayed as Factory View.
EquipmentContextSettings configuration table on the launch point configuration thing.
* 
Only Assets, or equipment types that derive from Assets, can be included in more than one contexts. All other equipment types can belong only to a single context. For more information, see Defining Equipment Types.
The following information is defined for each context:
ContextName—(Required) The name for the context. Must be unique within the EquipmentContextSettings configuration table. If no value is specified for the LocalizationToken property, then this value displays for the context in ThingWorx Apps.
Network—(Required) The name of the network entity used for this context. Must be unique within the EquipmentContextSettings configuration table. The equipment and equipment structure created for the context reside in the network. Once a context has been populated, if the network associated with the context is changed to another network, the equipment residing in the original network is no longer available in ThingWorx Apps. If the new network contains any existing equipment or equipment structure that does not conform to the equipment relationships defined in the EquipmentRelationshipSettings for the context, then context-aware areas of ThingWorx Apps do not behave as expected. The network must exist before the context can be created.
Description—An optional description for the context. The description displays in the Select Context window in the ThingWorx Apps user interface.
LocalizationToken—The localization token that is displayed as the name for this context in ThingWorx Apps. If no LocalizationToken is specified, the ContextName value displays as the context name instead. By default, the localization token defined for the default context is PTC.SCA.SCO.Context.DefaultContextName, which displays as Factory View in the ThingWorx Apps user interface. For more information, see Localization Tables in the ThingWorx Help Center.
EquipmentRelationshipSettings—(Required) The equipment relationship definition data table defining the valid relationships for this context. Each context can use a different equipment relationship definition data table, or multiple contexts can use the same equipment relationship definition data table. By default, the equipment relationship definition data table for the default context is PTC.SCA.SCO.DefaultEquipmentRelationshipDefinition. If the EquipmentRelationshipSettings value for the context is changed, and any existing equipment or equipment structure no longer conforms to the valid relationships for the context, then context-aware areas of ThingWorx Apps do not behave as expected.
Enabled—When this checkbox is selected (the default), the context is available within ThingWorx Apps. If this checkbox is cleared, the context is disabled, and does not appear in the context-aware areas of ThingWorx Apps.
To create a network entity:
1. In ThingWorx Composer, select Networks from the Browse pane, and click New.
2. Enter a name for the new network. This is the value to be entered as the Network for a context on the EquipmentContextSettings configuration table.
3. Click Save to create the network.
4. On the Permissions page for the network, select Visibility.
5. Search for and select the PTC.Factory.MachineVisibility organization. This grants the same visibility permissions to the ThingWorx Apps user roles as are granted in the default context.
6. Click Save to save the network.
* 
The permissions necessary for individual users and user groups to access the context and equipment within the context are set using the services described in Managing Context and Equipment Permissions.
To create a new context:
1. Navigate to the Configuration page of PTC.Factory.C_LaunchPointConfigurationThing_[ReleaseVersion].
2. Click Add on the EquipmentContextSettings configuration table.
3. In the EquipmentContextSettings window, specify the information for the context.
4. Click Add to add the context to the configuration table.
5. Click Save to save the launch point configuration thing.
To edit a context:
1. Navigate to the Configuration page of PTC.Factory.C_LaunchPointConfigurationThing_[ReleaseVersion].
2. Click Edit icon next to the context that you want to edit in the EquipmentContextSettings configuration table.
3. On the EquipmentContextSettings window, edit the desired fields.
4. Click Set to update the context in the configuration table.
5. Click Save to save the launch point configuration thing, and apply the changes made to the context.
To delete a context:
Deleting a context removes the entry from the EquipmentContextSettings configuration table. The associated network, with its existing equipment and equipment structure, remain intact in the system, but are not accessible in the context-aware areas of ThingWorx Apps. Adding a new context which references the network that was previously associated with the deleted context will make that existing equipment accessible in the context-aware areas of ThingWorx Apps once more, in the new context.
1. Navigate to the Configuration page of PTC.Factory.C_LaunchPointConfigurationThing_[ReleaseVersion].
2. On the EquipmentContextSettings configuration table, click Delete icon. next to the context that you want to delete.
3. Click Save to save the launch point configuration thing.
* 
There must always be at least one context present in the EquipmentContextSettings configuration table. If all contexts are deleted from the table, the system automatically restores the default context (DefaultContext) to the EquipmentContextSettings configuration table when the launch point configuration thing is saved.
Was this helpful?