A Data Connector import rule can import regular (single) data classes and multi rowed data classes. A regular data class, for example, could be a computer's Serial Number. A multi rowed data class, for example, could be any number of Cost Items that are associated by a foreign key to a computer. This article provides two examples of how to import multi rowed data classes. First, Cost Items will be discussed. Second, IP Addresses will be discussed. These instructions can be easily adapted, however, to any multi rowed data class that the customer wishes to import. Note: This article assumes that the customer is familiar with creating and configuring Data Connector import rules, and therefore skips some of the otherwise necessary steps to fully set these up.
Example 1: Import multi rowed Cost Items.
- Data must be created. For this example, create a new data file (.txt or .csv) on the Symantec Management Platform server and add computers that will include Cost Items. This can look like the following:
Name, Type, Accounting Code, Date, Amount, Status, Description
PC1, Contract, Expense, 3/5/2014, 39.99, Incurred, Purchase of a new mouse.
PC1, Contract, Expense, 3/5/2014, 29.99, Incurred, Purchase of a new keyboard.
PC2, Contract, Expense, 3/5/2014, 19.99, Incurred, Purchase of a new mousepad.
Notes:
(1) For each multi rowed data class to import, the resource must be specified more than once. When this example is imported, this will create or update the computer PC1 with two Cost Items (rows 2 and 3), and PC2 with one Cost Item (row 4).
(2) Do not specify current, "$", in the Amount field as this will be skipped because it is a non-numeric value.
- In a Symantec Management Platform, create a new import Data Source that points to the data file.
- Create a new import rule and point it to the data source. Configure it to use the Computer resource type. Then, set the Resource Lookup Key, such as to Resource Name.
- Set the Update Mode to be Append. The other drop-down fields for the Cost Items data class should automatically be filled in as they are named as the same name, from the data file. This should then look like the following:
Notes:
(1) While none of the Cost Items data classes are "not nullable" (in other words, required and with a non-blank value), many should still be filled out nevertheless. For example, it's a good idea to include at least the Date and Amount. Others may be filled out as the customer needs them to be, such as the Purchase Order number.
(2) Foreign keys must already exist in the database under their own resource type, similar to associations. For example, if the customer decides to add a Purchase Order of "POrder00000003" as a new Purchase Order column in the data file and then specify this in the Purchase Order data class, the Purchase Order of "POrder00000003" must already exist in the database. Otherwise, this column is skipped when the computer record is imported from the data file as it cannot find "POrder00000003" to match up to. For Cost Items, this affects the Type, Accounting Code, Purchase Order and CurrencyGuid data classes.
(3) Be careful when using multi rowed data classes as they have the potential to wipe out all that were previously set in the same record. This is controlled by the Update Mode drop-down list. Usually this should be set to Append, not Update or Replace, for multi rowed data classes.
- Run the import. Afterwards, edit PC1 and PC2 to spot check that their Cost Items are set correctly. PC1's Cost Items should then look like the following:
Example 2: Import multi rowed IP Addresses.
- Data must be created. For this example, create a new data file (.txt or .csv) on the Symantec Management Platform server and add computers that will include IP Addresses. This can look like the following:
Name, IP Address, IP Version, MAC Address
PC1, 1.1.1.1, IPv4, 00:00:00:00
PC1, 1.1.1.2, IPv4, 00:00:00:01
PC1, 1.1.1.3, IPv4, 00:00:00:02
Note: For each multi rowed data class to import, the resource must be specified more than once. When this example is imported, this will create or update the computer PC1 with three IP Addresses.
- In a Symantec Management Platform, create a new import Data Source that points to the data file.
- Create a new import rule and point it to the data source. Configure it to use the Computer resource type. Then, set the Resource Lookup Key, such as to Resource Name.
- The default IP Address data class under Network Resource Details that most resources use is not the actual one that will be used to hold multi rowed data. This can contain only a single IP Address. Instead, add the non-default data class Device TCPIP by clicking on "Select data class" and then selecting the Network Device Data folder to see and pick the Device TCPIP data class. Add that to the right column then click on the OK button.
- WARNING: The customer then sees a warning stating that this data is not normally imported but they should instead allow the Symantec Management Agent to bring this in. This is correct. When possible, do not attempt to mock up inventory in this fashion as this can result in later issues. But if the customer is sure this is what they need to do, then proceed with these instructions.
- In the Device TCPIP data class, click on its drop-down lists and select IP Address for IP Address, IP Version for IP Version and MAC Address for MAC Address. This should then look like the following:
- Run the import. Afterwards, go to Resource Manager for PC1 then go to View > Inventory. Then go to Network Device Data > Device TCIP. This should then look like the following: