Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info

Es wird empfohlen, den Import zunächst in einer eigenen Testumgebung durchzuführen.

Importer installieren

Wie im oberen Artikel beschrieben, wird eine Importer.exe benötigt. Diese kann selbst geschrieben werden. Für die meisten Fälle bietet antony aber Standard-Importer an. Diese können im Hub manuell installiert werden. Dazu auf im Hub auf Umgebungsverwaltung > Produkteund den Punkt Produkt installieren aufklicken und den Namen des gwünschten Importers angeben.

  • AntonyDataImportCsv

  • AntonyDataImportMsSql

  • AntonyDataImportMySql

  • AntonyDataImportOdbc

  • AntonyDataImportOracle

_import_configuration

The _import_configuration Table holds some basedata for the import.

Database field

Description

id

Each Import has its own id. This is a GUID, you can simply generate

is_active

With this flag you can activate (1) and deactivate (0) the import

debug

The AntonyImportModule creates files, which are interpreted by the Importer.exe. The `importer.exe` reads this files and produces an output file. If the dbeug flag is set to true, these two files will not be removed. You can find it unter %TEMP%\AntonyImporter of the user, the services runs under. For LocalSystem you can find it C:\Windows\Temp\AntonyImporter

Panel
panelIconIdatlassian-warning
panelIcon:warning:
bgColor#FFFAE6

These files will not be removed, if debug = 1. Be careful, as your hdd space might become a problem.

frequency

The frequency the import will be triggered.

Format: <d>.<HH>:<MM>:<ss>. You cannot define a range unter a minute, as the importer only checks one per minute.

import_name

The name of the import. Free for use

comment

A comment for this import. Free for use

connection_information

Some ConnectionInformations the importer.exe will get within the importConfiguration. This might contain a ConnectionString or API Adress or something else. This information is only used by the importer.exe

import_group

Someday you want to configure multiple imports from the same origin. These imports might contain a link to each other like as CustomerId within an Order In this case you can place the two imports into the same ImportGroup. The importer will fill the import_state with the mappings from every import within the import_group with the mapping_name. With an Converter Lookup you can translate the id of the foreignSystem to the antony ids.

This feature was orignally designed for customer link fields within an flexobject

mapping_name

This setting is only relevant in combination of an import_group. If set you can access the state from another import within the importer.exE by this name.

You need to make sure, that the mapping_name is unique over all of your configured imports. Otherwise the importer cannot relate the foreign_id of the importee to antony’s ids.

importer_exe

The Full Path to the importer.exe which is executed by the AntonyImportModule. The BasePath the importer is called in is within the %TEMP% Path. So perhaps you want to the it within you importer.exe

import_exe_args

This arguments are passed to the importer.exe. It is free to use.

target_type

The type the importer should import to. This can be

  • “antony://contact” for a contact

  • “antony://appointment” for an appointment

  • “antony://flexobject/<typeId>” for an FlexObject. The typeId is the id of the flexobject type. See table “Flexobject” for more infos.

import_parameter

These are some parameter the importer.exe can get to be configured. You also can use importer_arguments bis the importer_parameter is designed to gets bigger data like an SQL Query or perhaps a Json Payload. You might not want to get this info via Command Line Arguments

merge_fields

Sometimes you don't want to import a whole object, but only import some data from a system to an existing one. Imagine you import some orders from a shop into a flexobject. Aou have also an ERP which holds the status of this order by a the ordernumer of the order. With the merge_fields you can configure your import to Update an existing Flexobject instead of creating a new one.

Therefore the importer will check, if there is already a flexobject with the value the importer.exe provides in the field merge_fields. If so, this flexobject will be updated by this Import

If you have multiple Flexobjects which are matching the condition, then ALL flexobjects will be updated. You can provide multiple fields which ALL needs to match. The field within the database is comma-separated

You have multiple Flexobjects which are matching the condition, then ALL flexobjects will be updated

batch_size

This sets the size of the batch the importer imports without a delay. The defaultvalue is 1. This option and the delay_between_batch is usefull, if you import big datasets (lets say big = >200). In this case antony will create 200 single create and updates, which will impact the performance and stability of your whole installation.

delay_between_batch

This sets the delay the importer adds on every batch, defined by batch_size. So if you import a big dataset

suppress_create

This flag is usefull if you want to make sure, that no item will be created by the import. Use this if you only want to import some additional data from a source to an already existing dataset within antony. F.e. a generated link of your Shop or ERP

import_configuration_mapping fields

This table contains the configuration of the import on how the provides fields of the importer.exe are mapped to the antony field.

Database field

Description

id

An incremental id

foreign_source_field

This is the fieldname the importer.exe provides to the AntonyImportModule. This might be the name of a column for ODBC Importer or from a json or so on. This one is specific to the importer.exe

antony_target_field

This is the field of your configured target_type the foreign_source_field should be written to. Be sure that this field is only mapped once for an import configuration.

For customFields you need to know the <ID> of the field. The easiest way to get this is to open the flexobject in layout mode and copy it from the properties view.

converter_infos

Here you can configure converters to convert the values provided by the importer.exe. Each Converter needs two parameter

  • ConverterName: This is the name of the converter. You might provide some converter within your code or use std. one. There are two defined

    • Expression: Takes a C# Linq Expression to freely convert the value

    • IdLookup: This Converter can be used to lookup an id from the import_state. Is is usefull in combination with import_group

  • ConverterParameter: The parameter the converter takes. The value depends on the converter used

    • Expression: The Expression to use. f. (x)=> x.ToString().ToUpper()

    • Lookup: The mapping_name you want to lookup

An example could be

Code Block
languagejson
[
{
  "ConverterName":"Expression",
  "ConverterParameter":"(x) => new int[] { 73, (int.Parse(x.ToString()))  }"
}
]

Be sure to properly quote the QuotationMarks (“ to \”)

comment

A comment. This can be filled by you to still understand the mapping in 2 days.

import_configuration_id

The ImportId of the importer. This one is the link to the _import_configuration table

List Antony Fields

Of course you want to configure the mapping of the fields to the according antony fields. Therefore you need to know the name of the fields antony provides. You can find them here

Contact

TargetType: “antony://contact”

Antony Mapping Field

.net Data-Type

Comments

MainContactId

System.Int64

This is the id of antonys main contact, if the contact wants to be a subcontact. Normally you wont have this present within the foreign system - So you need to map them. Therefore you can use the build in Converter “IdLookup” and provide the mapping_name of the corresponding import. The importer will resolve antonys MainContactId automatically.

Code Block
languagejson
[{ "ConverterName": "IdLookup", "ConverterParameter": "integra"}]

If the given main contact isn't present within antonys import mapping, the crearted contact will be a normal main contact

TitleId

System.Int64

The id of the title of the contact. You can find them in the table type_title

Company

System.String

Firstname

System.String

Lastname

System.String

Street

System.String

Zipcode

System.String

City

System.String

State

System.Int64

The id of the state. You can find it them in the table type_state

CountryId

System.Int64

The id of the country. You can find them in the table type_contry

Phone

System.String

Phone2

System.String

Fax

System.String

Email

System.String

Mobile

System.String

Homepage

System.String

Comment

System.String

StreetPrivate

System.String

ZipcodePrivate

System.String

CityPrivate

System.String

StatePrivate

System.Int64

The id of the state. You can find it them in the table type_state

CountryIdPrivate

System.Int64

The id of the country. You can find them in the table type_contry

PhonePrivate

System.String

Phone2Private

System.String

FaxPrivate

System.String

Department

System.String

Picture

Byte[]

Birthday

System.DateTime

Be sure to place LocalTime here

ContactGroup

System.Boolean

This is a write only property. If you pass a contact group here the contact will be added to the given contact group. The present contact will not be removed from existing ones

Customfields of contacts can be added by placing Field_n within the antony_field. The n is the id of the customfield itselve. You can either grab is from antonys visual editor or the table instance_customfields

Appointment

TargetType: “antony://appointment”

Antony Mapping Field

.net Data-Type

Comments

UID

System.Int64

Sequence

System.Int64

AllDay

System.Boolean

StartDateTime

System.DateTime

LOCALTIME!

EndDateTime

System.DateTime

LOCALTIME!

Subject

System.String

Location

System.String

Description

System.String

Label

System.Int64

Status

System.Int64

IsPrivate

System.Boolean

HasReminder

System.Boolean

True, if a reminder is configured

ReminderTimeBeforeStart

System.Int64

The number of nanoseconds of the reminder time.

This is some kind of technical dept.

ResourceIds

List`1

The ids of the resource the appointment should be placed in. You can find them within the antony admin.

Example converter_infos placing an appointment within calendar 73 and the mapped field.

Code Block
languagejson
[{"ConverterName":"Expression","ConverterParameter":"(x) => new int[] { 73, (int.Parse(x.ToString()))  }"}]

Creating recurring appointments is not supported.

Flexobjects

The importer is also able to import flexobjects, which are configured within your environment. As a flexobject only contains CustomFields you need to look them up. They can be added by placing Field_n within the antony_field. The n is the id of the customfield itselve. You can either grab is from antonys visual editor or the table instance_customfields

TargetType: “antony://flexobject/<type_id>”

The type_id is the id of the type of the flexobject itselve. You can find it in the table flexobject

Conclusion

The import is a powerful but complex tool to import any data from an external datasource. You can also write a custom importer to grab data from your custom source.

If you have troubles to get your import up an running, please contact us.