.06 Hops
Hops
A hop connects one transformation step or job entry with another. The direction of the data flow is indicated with an arrow on the graphical view pane. A hop can be enabled or disabled (for testing purposes for example).
Â
The following topics are covered in this section:
- #Transformation Hops
- #Job Hops
- #Creating a Hop
- #Splitting a Hop
- #Loops
- #Mixing Rows-Trap Detector
- #Transformation Hop Colors
Â
Transformation Hops
When a hop is disabled in a transformation, the steps that follow the disabled hop are cut off from any data flowing upstream of the disabled hop. This may lead to unexpected results when editing the downstream steps. For example, if a particular step-type offers a "Get Fields" button, clicking the button may not reveal any of the incoming fields as long as the hop is still disabled.
Job Hops
Besides the execution order, a hop also specifies the condition on which the next job entry will be executed. You can specify the evaluation mode by right clicking on the job hop:
- "Unconditional" specifies that the next job entry will be executed regardless of the result of the originating job entry.
- "Follow when result is true" specifies that the next job entry will only be executed when the result of the originating job entry was true, meaning successful execution, file found, table found, without error, evaluation was false, ...
- "Follow when result is false" specifies that the next job entry will only be executed when the result of the originating job entry was false, meaning unsuccessful execution, file not found, table not found, error(s) occurred, evaluation was false, ...
Â
Creating A Hop
Create a new hop between two steps using one of the following options:
- Drag the Graphical View between two steps while holding down the middle mouse button
- Drag the Graphical View between two steps while pressing the <SHIFT>key and using the left mouse button
- Right click and select New Hop to select two steps in the tree
- Use <CTRL> + left-click to select two in the graphical view; the right-click on the step and choose New Hop
Â
Splitting a Hop
Insert a new step into a new hop between two steps by dragging the step (in the Graphical View) over a hop. You will be asked if you want to split the hop. This feature works only with steps that have not yet been connected to another step.
Loops
Loops are not allowed in transformations because Spoon depends heavily on the previous steps to determine the field values that are passed from one step to another. Allowing loops in transformations may result in endless loops and other problems.
Loops are allowed in jobs because Spoon executes job entries sequentially. Make sure you don't build endless loops. This job entry can help you exit closed loops based on the number of times a job entry was executed.
Mixing Rows-Trap Detector
Mixing rows that have a different layout is not allowed in a transformation. Mixing row layouts causes steps to fail because fields can not be found where expected or the data type changes unexpectedly.
The "trap detector" provides warnings at design time if a step is receiving mixed layouts:
In this case, the full error report reads:
We detected rows with varying number of fields, this is not allowed in a transformation. The first row contained 13 fields, another one contained 16 : customer_tk=0, version=0, date_from=, date_to=, CUSTOMERNR=0, NAME=, FIRSTNAME=, LANGUAGE=, GENDER=, STREET=, HOUSNR=, BUSNR=, ZIPCODE=, LOCATION=, COUNTRY=, DATE_OF_BIRTH=
Note: This is only a warning and will not prevent you from performing the task you want to do.
Transformation Hop Colors
Transformation hops display in a variety of colors based on the properties and state of the hop. The following table describes the meaning behind a transformation hop's color:
Hop Color |
Meaning |
---|---|
Green |
Distribute rows: if multiple hops are leaving a step, rows of data will be evenly distributed to all target steps. |
Red |
Copies rows: if multiple hops are leaving a step, all rows of data will be copied to all target steps. |
Yellow |
Provides info for step, distributes rows |
Magenta |
Provides info for step, copies rows |
Gray |
The hop is disabled. |
Black |
The hop has a named target step. |
Blue |
Candidate hop using middle button + drag |
Orange (Dot line) |
The hop is never used because no data will ever go there. |
Red (Bold Dot line) |
The hop is used for carrying rows that caused errors in source step(s). |