Skip to content

Cortex to Cortex Import

Concept

Within your CortexEngine, you can change the content of records and the entire data model using this import function.

  • The data source and target are the same CortexEngine instance.
  • The source usually consists of a list definition and the records of a selection or a record type.
  • The records are prepared based on the list configuration, so you can also use calculated list contents to change the records.

A list definition serves as the basis for this import function, so the global settings and the ImportSection are identical to those of the CSV import. The section for the settings of the ReaderModule must be adapted, assign it the type ctx.

Configuration

This configuration block contains the specifications for the list definitions (ListDef) and the record type or selection.

If all records of a record type are to be changed, you must set the specification for the record type.

ReaderModule Setting and Record Type specification
<ReaderModule type="ctx">
  <ListDef>[.......]</ListDef>
  <Recordtype>[....]</Recordtype>
</ReaderModule>

To change only the records of a previously saved selection, enter the selection name.

Setting ReaderModule and Specifying Selection Name
<ReaderModule type="ctx">
  <ListDef>[.......]</ListDef>
  <Selection>[....]</Selection>
</ReaderModule>

The records can only be updated using the record ID. This eliminates the need to specify a reference because a record is already found uniquely. The source field for the ID is specified in the configuration as \#IId.

Updating all Records of a Record Type Using the Record ID and a Created list
<?xml version="1.0" encoding="UTF-8"?>
<CtxImport>
  <Global>
    <LoginIP>127.0.0.1</LoginIP>
    <LoginPort>29001</LoginPort>
    <LoginUser>admin</LoginUser>
    <LoginPW>adm#13qzy2!</LoginPW>
    <ImportMode>u</ImportMode>
  </Global>
  <ReaderModule type="ctx">
    <ListDef>Personenliste</ListDef>
    <Recordtype>PERS</Recordtype>
  </ReaderModule>
  <ImportSection recordtype="PERS">
    <Reference></Reference>
    <IId>getChar('#IId')</IId>
    <Field>perName=getChar('Name')</Field>
    <Field>perVorn=getChar('Vorname')</Field>
    <Field>perAOrt=getChar('Ort')</Field>
    <Field>perSuch=getChar('Vorname')+getChar('Name')</Field>
  </ImportSection>
</CtxImport>

Note

In this example, the reference in the ImportSection remains empty because the following specification is automatically treated as a reference: <IId>getChar('#IId')</IId>

You can also show the system field record ID in the list definition and enter it in the IId node mentioned: <IId>getChar('record ID')</IId>

  • The second option may be processed faster than the first.
  • The list used is processed sequentially for each record, so the use of calculated fields is only possible to a limited extent.
  • Cross-list calculations can therefore not be used.

Repetition fields

The general form for importing a repetition field from a list definition consists of the RepGroup node with a start attribute and then contains a field specification:

Importing repetition fields
<RepGroup start="___WDHL___">
    <Field deltalist="d">Synonym=getChar('sourceField')</Field>
</RepGroup>

The start attribute must contain the value ___WDHL___ (three underscores before and after WDHL). This specifies that the content of the node is to be treated as a repetition field.

In addition, you can specify the attribute deltalist="d" for the field. This means that when the record is updated, only the field contents that are supplied as data are retained. Contents that are not in the source are removed.

Notes

Please note that using the individual parameters for repetition field groups can have unexpected effects. Updating these groups is therefore not recommended.

The source field getChar('sourceField') must be a repetition field.

  • The content of this field can be overwritten by JavaScript.
  • The field type is important so that the Implex recognizes that a repetition field is being read.
  • An object set via JavaScript alone is not sufficient.