Importing Codes & Values to Code Properties

Simplify the management of code properties in Weissr by importing codes directly from the Admin UI. This feature is particularly beneficial for administrators who need to update numerous code properties regularly.

Configuration

Weissr support enables the code property by importing the YAML configuration file for server installation:

weissr:
  integration:
    property-code-import:
      enabled: true
      notification-email-recipient: "admin@weissr.com,admin@weissr-cloud.com"
      scan-cron: "-"  # To disable use "-"
      delimiter: ","
      skip-header-record: true
      import-format: default # Possible options: default, legacy
      workflow-folders:
        main-path: ${weissr.files.base-path}property-code-import/
        to-import-path: ${weissr.integration.property-code-import.workflow-folders.main-path}to-import/
        processed-path: ${weissr.integration.property-code-import.workflow-folders.main-path}processed/
        failed-path: ${weissr.integration.property-code-import.workflow-folders.main-path}failed/
  • Set up default recipients for import status notifications.

  • Use cron jobs and workflow folders for automated file uploads from S3 folders.

Import Format

The import process relies on a CSV file with the following structure possibilities:

  • DEFAULT Format

    • Field Separator: Default is comma. Can be changed in the YAML configuration.

    • Header Record: Can be skipped if necessary, specified in the YAML configuration.

    • Columns Required:

      • Code Property: Name or ID. Both can be used in the same import file.

      • Property Code

      • Property Value

    • Strategy:

      • If code exists in both the file and application and the value is the same, it is kept.

      • If code exists in both the file and application, but the value is different, it is updated from the file.

      • If code exists in the file but not in the application, a new code-value pair is created.

      • If code does not exist in the file but is present in the application, the code-value pair is removed (unless it is used in a request).

  • LEGACY Format

    • Field Separator: Default is comma. Can be changed in the YAML configuration.

    • Row 1: Property names. Each property requires two columns to map both the code and its corresponding value.

    • Row 2: Contains "Code" and "Value" headers for each property.

    • Row 3+: One code-value pair per row for each property.

The import will replace existing code-value pairs unless they are already used in requests. Used code-value pairs are skipped. The format cannot handle empty code-value pairs between valid pairs; all valid pairs after an empty one will be ignored.

Format Examples

DEFAULT:

Name

Code

Value

Season

winter

Winter

Season

spring

Spring

Weather

cold

Cold

Weather

cool

Cool

Month

january

January

Month

february

February

Public Holidays Sweden

new_years_day

New Year's Day

Public Holidays Sweden

epiphany

Epiphany

Property name,Code,Value
Season,winter,Winter
Season,spring,Spring
Weather,cold,Cold
Weather,cool,Cool
Month,january,January
Month,february,February
Public Holidays Sweden,new_years_day,New Year's Day
Public Holidays Sweden,epiphany,Epiphany

LEGACY:

Season

Season

Weather

Weather

Month

Month

Public Holidays Sweden

Public Holidays Sweden

Code

Value

Code

Value

Code

Value

Code

Value

winter

Winter

cold

Cold

january

January

new_years_day

New Year's Day

spring

Spring

cool

Cool

february

February

epiphany

Epiphany

The example above should be converted to a CSV file with the following structure:

Season,Season,Weather,Weather,Month,Month,Public Holidays Sweden,Public Holidays Sweden
Code,Value,Code,Value,Code,Value,Code,Value
winter,Winter,cold,Cold,january,January,new_years_day,New Year's Day
spring,Spring,cool,Cool,february,February,epiphany,Epiphany

Performing the Import

Navigate to Administration → Common → Integrations → Property codes import to perform the import and review the results. Logs about skipped, removed, and added properties are available in Integration logs.

image-20240522-111704.png
Example of a log result.