Skip to main content
Skip table of contents

Mappings

There are basically two ways of mapping data:

As is so often the case, what you prefer is a matter of taste. Both approaches are supported by the Designer - and both have their advantages and disadvantages. We will outline these below.

Graphical Mapping

In the Designer, you can create a mapping diagram by creating a mapping operation on a class.
The mapping diagram is based on the data model contained in the Implementation folder. It defines mappings between the data structures defined in this data model. You cannot change the data model in the mapping diagram, all attributes are read-only.

Use graphical mapping

  • if only a few attributes have to be mapped.

  • if you want to document which attributes are used for the mapping.

Expert Advice

  • Use graphical mapping as long it is well arranged and clearly readable.

  • Use suboperations to summarize mappings thematically, e.g. header data and item data. This makes more complex mapping diagrams easier to read.

Pros and Cons

Pro

Con

  • Good graphical view including mapping rules on dependencies

  • Takes long time to draw

  • Problematic when re-importing classes

Script Mapping

In the Designer, you can create an Action Script or a JavaScript operation on a class to script your data mapping.

Use script mapping

  • if you have many attributes or complex mappings with rules and conversions.

Expert Advice

Split up complex mapping into several scripts to maintain clarity.

Pros and Cons

Pro

Con

  • Searchable

  • Unproblematic when re-importing classes

  • Complex scripts can become incomprehensible

Usage of mapEqualNames

In the Designer, you can use a comfort feature if data source and target are set up in the same way: The mapEqualNames macro.

The macro generates set statements for all equal named, equally typed attributes found in the target object and at least one of the input objects. This applies to all public attributes including all inherited attributes.

Use mapEqualNames

  • if the classes are given through a backend.
    Example: You have two classes createCustomerClass and updateCustomerClass. The classes are equal but createCustomerClass has custID in addition.

Expert Advice

Be careful when using it and ask yourself: Are the attribute names of the two classes really the same and have all equal types?

Refer to mapEqualNames() Macro and mapEqualNamesIfExists() Macro for details.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.