Importing addressbook entries

Back to Weiteres Beispiel für Zuordnungskriterien


Procedures on this page:


This example assumes access to the Lobster_data installation on which the Lobster Data Platform / Orchestration is operated, as well as basic knowledge of how to use Lobster_data (creating profiles).


At the end of the tutorial the following task can be executed to learn about the interaction between lobster_data and Lobster Data Platform / Orchestration (see also Lobster_data integration).

Specifically, a list of addresses in CSV format is imported in Lobster Data Platform / Orchestration to add new Adressbucheinträge to an existing Address book or to update existing ones.

Preparations for the import

Create CSV file

The data to be imported should be in CSV format as a file. The semicolon (';') is expected as a separator between columns. The following columns should be filled per row:

  • ADNR → an identification number for the address, which is taken over into the field 'Account number' (accNumber) of the address during import.
    IMPORTANT◄ This code number is used to determine whether an address book entry already exists for an address, which the import should update. So it should be unique within the list!

  • NAME1 → the text for the primary name field 'Name 1' (name1) of the address

  • STR → the text for the field 'Street 1' (street1) of the address

  • NR → the text for the field 'Street no.' (streetNo) of the address

  • CC → the text for the field 'Country code' (countryCode) of the address (see the dynamic enumeration Country)

  • ZIP → the text for the field 'Postal code' (zipcode) of the address

  • PLACE → the text for the 'City' field (city) of the address

The following sample data can be used to create a corresponding file. Of course, a file with the same structure can also be prepared with your own data.

ADNR;NAME1;STR;NR;CC;ZIP;PLACE
1234;Duck, D.;Waltstr.;23;DE;26725;Emden-Hausen
1252;Oliver, Roy;Burbank-Platz;71;DE;88316;Isny
1860;Torpodofaktur KG;Blauweisswalder Str.;186;DE;81060;Giesing
1968;SpringTimers sro;U Vesna;218;CZ;19068;Praha
1999;Rogers, N.;Tafkap Drive;1958;US;55488;Minneapolis (MN)

Prepare a CSV file for import from this data or according to this model, and save it in a local directory under the name VIP_ADDR.csv!


Create address book

An independent address book is set up as the destination for the address import.

Via the menu path Administration/Master data/Address books, you get to the overview for address books. Create a new Address book with the Name 'Consignees' and assign the Types shown in the screenshot (see Company type):

images/download/attachments/62856514/image2020-11-20_10-55-21-version-1-modificationdate-1605866122871-api-v2.png

The newly created address book is assigned a unique internal ID (id) when it is saved. This integer ID is used in later steps to identify the address book.

NOTE◄ The image for the 'ID' column has the value 105. Use the different ID value of your address book if this value is used in the following steps!

Create import profile

To Import the Adressbucheinträge, a new profile must be created in Lobster_data and then configured as described in the following section.

General data

Parameterize the General data tab of the new profile as follows:

  • Name → a descriptive name for the task of the profile e.g. 'ADDR_IMPORT_CNE' ('CNE' is the internal abbreviation for the company type 'Consignee', see Company type)

  • Document type → CSV

images/download/attachments/62856514/image2020-11-20_8-42-6-version-1-modificationdate-1605858128104-api-v2.png

Phase 1: Input agent

Select the input agent Manual upload from the category 'Event controlled'.

images/download/attachments/62856514/image2020-11-20_8-43-13-version-1-modificationdate-1605858195205-api-v2.png

Phase 2: Parser

For the parser the shown default settings can be used with one exception:

  • The value for Start at row should be increased from 1 to 2 because the CSV file contains column names in the first row, which of course should not be read as address data.

images/download/attachments/62856514/image2020-11-20_8-44-23-version-1-modificationdate-1605858264307-api-v2.png

Phase 3: Mapping (Source structure)

The source structure for the mapping in Phase 3 can be created largely automatically using the Create structure from file analysis function by importing and evaluating the file 'VIP_ADDR.csv':

images/download/attachments/62856514/image2020-11-20_8-47-16-version-1-modificationdate-1605858437685-api-v2.png

The function is called from the menu below the Source structure area. It allows the 'import' of the locally saved file via a file browser or by drag & drop.

The default settings can be retained for the parameters that can be selected in the Analyze file dialog during file analysis:

images/download/attachments/62856514/image2020-11-20_8-48-17-version-1-modificationdate-1605858498270-api-v2.png

  • The value 1 for Row(s) has the effect here that in contrast to the parser configuration (see above), the first row is processed to interpret the column names as field names.

  • With the options Add as new test file and Load and show test data, the file is available for testing.

The file analysis with the sample data results in the following source structure (including the display of Test data and Data type):

images/download/attachments/62856514/image2020-11-20_8-50-34-version-1-modificationdate-1605858635530-api-v2.png

  • The Row1 node was automatically inserted to merge the fields.

  • For this node, the record type identifier 'Is not: _____ nothing _____' is set as the record type identifier for this node. So all rows of the file are evaluated as a 'row' with the given fields.

Phase 3: Mapping (Target structure)

Import templates

The Target structure has to be set up appropriately for the planned Import. Lobster SCM templates are used in two steps:

  • Since a Batch import is to be executed, the core:BatchImport template must first be loaded into the Target structure.

images/download/attachments/62856514/image2020-11-20_8-52-41-version-1-modificationdate-1605858762823-api-v2.png

Afterwards, the base:AddressBookEntry template with the Append structure as subnode option must be loaded to the batch node of the target structure then created:

images/download/attachments/62856514/image2020-11-20_8-53-51-version-1-modificationdate-1605858833024-api-v2.png

Settings for 'BatchImport' node

The desired transaction control option (SINGLE or BATCH) must be selected in the trx_Control_attr field in the 'Header level' of the BatchImport structure:

images/download/attachments/62856514/image2020-11-20_8-55-57-version-1-modificationdate-1605858958444-api-v2.png

  • With the BATCH option selected by fixed value in the field, the import of all rows is treated as a transaction. The import is then either successful for all 'rows' or it will fail completely.

  • With the alternative SINGLE option, each imported row would be treated as an independent transaction that can or cannot be successfully imported.

The batch node defines the import action repeated in the loop over all imported lines:

images/download/attachments/62856514/image2020-11-20_8-58-19-version-1-modificationdate-1605859100890-api-v2.png

  • In the field action_attr, CREATE_OR_UPDATE is assigned as a fixed value, since only new addressbook entries should be created if no 'suitable' update is found.

  • Alternative options here would be CREATE (only add new ones), UPDATE (only update existing ones) and DELETE (delete existing ones).

  • The node eventStorage is not needed. It can be deleted or set to inactive (see above).

Further details are documented for the Single import, which corresponds to a single repetition of the batch node.

Define search for existing addressbook entries

For the Import with the CREATE_OR_UPDATE action, the search subnode is used to define a Search which checks for each source data line whether a unique target for an UPDATE can be identified or whether a new address book entry is to be created with CREATE.

In the concrete application case the following criteria will be examined:

  1. The identifier read as ADNR should be exactly equal to the value of the address field 'account number' (address.accNumber) in the address book entry.

  2. The address book entry should be contained in the address book created above. Then its internal ID (in the example: 105) appears in the addressBookId field of the addressbook entry.

The corresponding Search can be easily set up and tested with the Search builder, which is started in the Lobster Data Platform / Orchestration via the menu path Administration/System/Search builder.

The entity 'Address book entry' is selected as the Entity of the Search.



  • The first Einfache Feld Einschränkung limits the search here to the relevant target address book. For the Long value, the ID of the address book that was previously created on your system must be entered here (instead of the value 105).


  • The second Einfache Feld Einschränkung further restricts the search (due to the conjunction (AND) within the predefined address book) by comparing the address field 'Account-No.'. The Long value 1234 entered as comparison value serves only as placeholder. In the profile, a reference to the source field ADNR must be used in the mapping. If your destination address book already contains entries, you can use the 'Account-No.' of an existing entry here for testing.

images/download/attachments/62856514/image2020-11-20_9-10-25-version-1-modificationdate-1605859826514-api-v2.png


If the Search is structured as described and successfully tested by Execute (in the ribbon), its definition can be transferred to the Lobster_data profile:

  • The XML tab in the Search builder shows the internal definition of the search built with the graphical editor as XML structure.


  • For the search node within the target structure of the import profile only the content of the core:Search element is relevantt. The storage node can be omitted, so that only the AND link with the contained restrictions (see Where in the editor) is needed.


  • This section can be selected as shown in the screenshot and copied via the clipboard of the operating system to paste these definitions into the target structure below the search node.

NOTE◄ Alternatively, it is also possible to 'build' the same structure by inserting Lobster SCM templates for the contained structures (core:SearchJunction, core:SimplePropertySearch) and parameterize them accordingly. However, at least for somewhat more complex searches, this method is certainly more time-consuming and more difficult to perform error-free than copy and paste via the clipboard.

images/download/attachments/62856514/image2020-11-20_9-12-58-version-1-modificationdate-1605859980277-api-v2.png

For insertion into the target structure of the Lobster_data profile, the search node should be selected there. Then the Lobster SCM templates function is selected from the target structure menu.

IMPORTANT◄ In the dialog that opens, the option Append structure as subnode must be selected. The account search should already be selected in the target structure.

  • Unlike when pasting a template, no entity is selected here, but the copied XML structure from the clipboard is pasted into the field Xml/Json to static structure.


  • By clicking on Apply, the corresponding structure is created below the search node.

images/download/attachments/62856514/image2020-11-20_9-14-58-version-1-modificationdate-1605860100342-api-v2.png

Now the link from the source field ADNR to the comparison value for the 'Account-No.' field within the second 'Simple property restriction' (PropertyProjection) must be created.

  • After selecting the source field (1) and the target field (2) – as shown in the screenshot – you only have to click on the button (3) for linking.

NOTE◄ Alternatively, the link can also be created by drag & drop from the source field (1) to the target field (2).


  • Finally, the Fix value (4) for the target field (2) taken from the clipboard must be deleted, otherwise it will override the assignment at runtime.

NOTE◄ Only when this has been removed and the Fix value property field has been exited does the 'lock' symbol for the field in question disappear and the value (1234) in the Fix value column (if displayed).

images/download/attachments/62856514/image2020-11-20_9-34-21-version-1-modificationdate-1605861263039-api-v2.png

Mapping for address data

Finally, the 'mapping', i.e. the assignment between source and target fields for the actual user data, must be set up. As in the previous step, this can be achieved by selecting and linking or by drag & drop.

  • The source field ADNR is to be linked to the target field accNumber_attr (see selection in the screenshot)


  • The further links are self-explanatory by means of labels. IIn the screenshot on the right, the 'assigned' fields each appear with a green dot. The sequence of fields on the right corresponds to the sequence of fields downwards from NAME1 on the left.


  • In addition, for the target field addressBookId the internal ID of the AddressBook to which the import refers must be specified as a Fix value (here: 105; use your AddressBook ID).

images/download/attachments/62856514/image2020-11-20_9-39-44-version-1-modificationdate-1605861586499-api-v2.png

Phase 5: Integration Unit

For the preparation of the target structure the option Use IntegrationUnit & post execution must be activated in Phase 5 so that an Integration Unit can be selected.

Since an XML structure is expected for the import in Lobster Data Platform / Orchestration, the XMLNoTemplateUnit must be selected here for creation.

  • The default values of the configuration can be kept here, only the Root node name must refer to the relevant 'root node' in the target structure. This is the 'BatchImport' node here.

images/download/attachments/62856514/image2020-11-20_9-41-25-version-1-modificationdate-1605861686820-api-v2.png

Phase 6: Responses

The minimum configuration for Phase 6 is a response path of the type 'Custom class', for which the Class ImportResponder (_data-Responder) is selected.

images/download/attachments/62856514/image2020-11-20_10-46-23-version-1-modificationdate-1605865584585-api-v2.png

In the second Content settings tab, the option 'Output of IU' must be selected for Content so that the BatchImport XML from Phase 5 is passed to the responder.

  • Subsequently, the configuration for the reply path Apply must be accepted before the profile is saved as a whole.

images/download/attachments/62856514/image2020-11-20_10-47-38-version-1-modificationdate-1605865659875-api-v2.png

Execute import profile

The profile can now be executed by 're-running' with the file 'VIP_ADDR.csv' to import the contained addresses.

If this procedure is repeated with a revised version of the file or an identically structured file with other data, 'known' addressbook entries should be updated and only 'new' entries should be added.