What is Attribute Mapping
Data in an AssemblyLine is stored as attributes in the work Entry.
The values of these attributes are mapped over from an input Connector. Inside the Connectors, there is a local Entry called conn.
When a Connector reads in and parses data, this information is stored in conn,
and must be transferred to the work Entry. Otherwise data read
will be gone when the Connector Attribute Mapping is done. Conversely, you
have to transfer attribute data from the work object to conn
in order for an output Connector to be able to update the data source.
Attribute Mapping from an input Connector may be considered as normalising
the data, you may change the name of Attributes from the named used in the Connector
to
what the AssemblyLine uses.
When is Attribute Mapping done
This depends on the mode of the Connector:
Iterator Mode - After the Connector has read (and parsed) the data into the conn
object, Attribute Mapping is done. You may refer to the conn Entry in the
Attribute Mapping code. The "After GetNext" Hook is called before
Attribute Mapping is done, and the "GetNext OK" Hook is called
afterwards. You may refer to the conn object in both of these Hooks as
well. The work object will be null in an Iterator.
Lookup Mode - After the Connector has located the data and put it into the conn
object, Attribute Mapping is done. The "After Lookup" Hook is called before
Attribute Mapping is done, and the "Lookup OK" Hook is called
afterwards. You may refer to the conn and work objects in both of
these Hooks, and in the Attribute Mapping code.
Update Mode - The Connector tries to locate the Entry to be updated.
- If no Entry is found, Attribute Mapping is done. Then empty Attributes
are removed, and so are Attributes not marked as Add in the Attribute Map.
Then the Hook "Before Add" is called, and the Entry is added to the
source. Then the Hook "After Add" is called. You may refer to the conn
and work Entry in both Hooks and in the Attribute Mapping Code. The conn
object is the
|