Importing data from a file
To add data to your data model more quickly, import data from a .csv file.
-
Access the data object.
- In the navigation pane of App Studio, click Data.
- Click Data objects and integrations.
- Click a data object.
-
Upload the file.
- Click the Records tab, and then click Import.
- In the Purpose list, select Add only.
- Click Choose File.
- Navigate to your .csv file, and then click Open.
- Click Next.
-
Map the columns in your file to the fields in the data object.
Tip: To make mapping faster, select a template from the Template list to use to define the mapping between the fields in your data object and the fields in the .csv file and skip the rest of this step.
-
In the Target field column, select the fields in your data
object that correspond to the fields in the .csv file shown in the Source
field column, or click Select to display a dialog
box for searching and filtering fields.
Note: You can select top level and embedded properties as targets for import.
If there are fields in your source that do not exist in the template, for example, if there is a field in the source called "Salutation" that is not available in the template, check if there is a field in the object you can map to. If there is no suitable field, you must add it.
The column headers in your .csv files must be unique as they correspond to field names in your application. For example, if you want to import the "Salutation" field from your .csv file to a property called "Salutation", ensure that the column header for the salutation is “Salutation”.
- Optional: If you are importing fields from an external system, you can apply business logic, such as lookups, decision trees, and decision tables to translate the external data into fields that are understood by Pega Platform. In the Mapping options column, click the Mapping options icon to select the type of business logic to use for translation, and click Submit. For more information, see Applying business logic when importing data.
- Optional: Enter a default value. For new records, the default value is used if the source field is blank. For existing records, the default value is used if both the source and target fields are blank. If you use a lookup, decision tree, or decision table, the source value is the value obtained from the lookup, tree, or table. It is not the value in the .csv file.
- Optional:
Set defaults for fields that do not have matching source columns in the .csv
file.
- Click View custom defaults.
- Click Add default value.
- In the Target field column, enter the target field or click Select to choose the target field from a list of fields.
- In the Default value column, enter the default value. For new records, the default value is used if it is provided. For existing records, the default value is used if the target value is blank.
- Click Next if you are finished mapping fields, or click Back to mapping to finish mapping fields.
-
In the Target field column, select the fields in your data
object that correspond to the fields in the .csv file shown in the Source
field column, or click Select to display a dialog
box for searching and filtering fields.
- Click Next.
- Optional: If you are using a dashboard gadget in your end-user portal that displays in-progress data imports and recently completed data imports, in the Name for this data import field, enter a short description that describes the import.
- To save your import settings for reuse when mapping fields, in the Additional import options section, click Save import settings as a template, and then enter the template name.
-
To control validation overhead, in the Skip validation section,
configure how much validation to use on imported data by selecting one of the following
validation options.
- To skip validation, Skip validation step entirely.
- Select Skip running validate rules if you want the system to perform basic validation. Basic validation checks that the property type of the data being imported matches the property type of the field in the data type.
- Clear Skip running validate rules if you want the system to perform advanced validation. Advanced validation performs basic validation, then runs the default validate rule of the data type on each record that is imported. Running the validate rule causes the import to take longer; however, it allows you more control when you need additional validation.
-
If you selected Skip running validate rules in step 7, click
Start validation.
Result: If an error is found, the record is removed from the valid records and is written to a row in the error .csv file. Fix the flawed rows and restart the import process. If you choose to continue the import without fixing the errors, the flawed rows are not imported.
-
Click Continue import.
You can close the dialog box for the data import process. The process runs asynchronously and is visible on your worklist.
- If you selected Skip validation step entirely in step 7, click Import.
- Click Finish.