Map flow is how data is interpreted during mapping. Flow points are those instances in the map flow at which the data being mapped causes the context for interpreting that data to change. In ECMap, this change in context is called a change in the level. If you think of map flow as an outline, the major entries in the outline represent levels; the places where the levels change represent flow points. While you remain at one level, data is interpreted in the manner dictated by the syntax, semantics, and business logic attached to the data in that level, whether it is EDI data or application data.
When the level changes, the manner in which the data is interpreted changes as well. The syntax, semantics, and business logic attached to the data in the new level assume control of how the data is interpreted.
ECMap can create basic map flow for transaction maps using information that it derives from the standards data being used in the map and from information that you supply. You can have ECMap create the basic map flow and then customize it, or you can build the flow yourself.
When you manually create flow, you must assign levels to segments in your EDI message and to flow points. In addition, you must also create rules that tell the program how to read, manipulate, and write the data, and attach these rules to the flow and to elements within the EDI segments.
The levels you assign to EDI segments are associated with the application data through the source and destination data linkages created in the mapping process. For any-to-any maps, you must manually create the flow using levels and rules.
Levels group related data objects—data objects that are interpreted in the same way by the program. For outbound transaction maps, this grouping of related data objects is determined by the context of the input—the sequence in which the input must be read in order to create the outgoing EDI message.
For inbound transaction maps, the grouping of related data objects is determined by the specific structure of the incoming EDI message, the format of the output, and the sequence in which the output must be written. For any-to-any maps, the levels are determined by the context of the input and the sequence in which these records must be read in order to create output records with the correct content and in the correct sequence.
In addition to defining the context for interpreting the data at specific points in a message, levels trigger mapping actions in transaction maps; mapping takes place each time a level changes. For example, levels allow you to map a segment (such as a DTM) to multiple record types, depending upon where the segment occurs. Levels can be obvious, such as Header, Detail, or Trailer—or subtle, such as distinguishing between a Ship To and a Bill To address.
Levels and rules work together to create the flow. While levels provide the grouping and sequencing of data, rules tell the program what actions it should perform on the data. A rule is a user-defined series of commands that can be attached either to a flow point in the map flow or to a specific data object. Rules that are attached to a flow point are executed when there is a change in the level, often called a level break or transition. Rules that are attached to data objects cause actions to take place when the program encounters these data objects during map execution. The commands within rules can perform many actions, such as reading and writing data, performing arithmetic operations and logical functions, calling other rules, and even performing no action.
Three kinds of rules can be associated with a flow point:
I/O rule
Before rule
After rule.
When a flow point is encountered in an outbound transaction map, the I/O rule is executed first and usually reads the input data. If the I/O rule is executed successfully, the Before rule is processed. The mapping then takes place. Finally, the After rule is processed. In inbound transaction maps, there are no I/O rules because the system implicitly knows how to read the Standards data. In any-to-any maps, the I/O rule is executed first and generally reads the input data; the Before rule usually performs the mapping; and the After rule normally writes the output data. For inbound maps, the Before rule and the After rule are executed on every flow point. For outbound maps and any-to-any maps, the Before rule and the After rule are executed only at flow points where the I/O rule has executed successfully. (Refer to the Rules chapter for a detailed explanation of how to perform rule-related actions.)
Levels and rules, and the flow associated with them, differ for inbound and outbound maps. The flow for any-to-any maps is the same as the flow for outbound maps.
For inbound maps, the flow is driven primarily by the EDI data used as input—you assign levels to the EDI data and define rules based on the output records you want to create. ECMap knows how to read the EDI data, but it must use the flow to determine level transitions and execute your rules to write the output.
For outbound maps and any-to-any maps, the process is reversed; the flow is based on how the data must be read. For outbound maps, ECMap knows how to write the EDI data, but you must define rules and assign levels to the EDI data so that the segments can be written at the points where the input data is read. For any-to-any maps, you must tell the program how to read and write the data, but the flow is driven by how the data must be read in order to create the correct output.
ECMap can automatically create basic map flow for you, or you can manually create the flow yourself. If ECMap creates the basic map flow, you can:
Modify the flow
Add or modify a new level, delete a level
Assign a level to a segment or remove a level that was previously assigned to a segment
Attach a rule to a flow point or to an EDI element
Remove a rule that was previously attached to either of them.
ECMap provides a variety of ways to use conditions to imbed business logic in your map. You can use conditional logic in your rules; you can make segments, elements, and flow points trading-partner-specific; and you can attach conditions to segments, elements, and flow points.
The flow for inbound, outbound, and any-to-any maps is different. In this chapter, we first discuss assigning levels to EDI segments, which is the same for both inbound and outbound transaction maps. Then, we discuss creating flow for each of the three types of map. Within flow creation, we first discuss creating map and record flow for outbound maps, then for inbound maps, and finally for any-to-any maps.