官术网_书友最值得收藏!

Time for action – assigning tasks by distributing

Let's suppose you want to distribute the issues among three programmers so each of them implements a subset of the new features.

  1. Open the transformation created in the previous section, change the description, and save it under a different name.
  2. Now delete all the steps after the Sort rows step.
  3. Change the Filter rows step to keep only the unassigned issues: Assignee field equal to the string Unassigned. The condition looks like this:
  4. From the Transform category of steps, drag an Add sequence step to the canvas and create a hop from the Sort rows step to this new step.
  5. Double-click on the Add sequence step and replace the content of the Name of value textbox with nr.
  6. Drag to the canvas three Microsoft Excel Output steps.
  7. Link the Add sequence step to one of these steps.
  8. Configure the Microsoft Excel Output step to send the fields nr, Priority, and Summary to an Excel file named f_costa.xls (the name of one of the programmers). The Fields tab should look like this:
  9. Create a hop from the Add sequence step to the second Microsoft Excel Output step. When asked to decide between Copy and Distribute, select Distribute.
  10. Configure the step as before, but name the file as b_bouchard.xls (the second programmer).
  11. Create a hop from the Add sequence step to the last Microsoft Excel Output step.
  12. Configure this last step as before, but name the file as a_mercier.xls (the last programmer).
  13. The transformation should look like this:
  14. Run the transformation and look at the execution tab window to see what happened. If you don't remember the meaning of the different metrics, you can go back and take a look at The Step Metrics tab section in Chapter 2, Getting Started with Transformations.
    Note

    Again, take into account that your numbers may not match the exact metrics shown here, as you derived your own source data from the JIRA system.

  15. To see which rows were to which of the created files, open any of them. It should look like this:

What just happened?

You distributed the issues among three programmers.

In the execution window, you could see that 401 rows leave the Add sequence step, and a third part of those rows arrive to each of the Microsoft Excel Output steps. In numbers, 134, 134, and 133 rows go to each file respectively. You verified that when you explored the Excel files.

In the transformation, you added an Add sequence step that did nothing more than add a sequential number to the rows. That sequence helps you recognize that one out of every three rows went to every file.

Here you saw a practical example for the Distribute option. When you distribute, the destination steps receive the rows in turns. For example, if you have three target steps, the first row goes to the first target step, the second row goes to the second step, the third row goes to the third step, the fourth row goes to the first step, and so on.

As you can see, when distributing, the hops leaving the steps from which you distribute are plain; they don't change its look and feel.

Despite the fact that this example clearly showed how the Distribute method works, this is not how you will regularly use this option. The Distribute option is mainly used for performance reasons. Throughout the book, you will always use the Copy option. To avoid being asked for the action to take every time you create more than one hop leaving a step, you can set the Copy option as default. You do it by opening the PDI options window (Tools | Options… from the main menu) and unchecking the option Show "copy or distribute" dialog?. Remember that to see the change applied you will have to restart Spoon.

Once you have changed this option, the default method is Copy rows. If you want to distribute rows, you can change the action by right-clicking on the step from which you want to copy or distribute, selecting Data Movement... in the contextual menu that appears, and then selecting the desired option.

Pop quiz – understanding the difference between copying and distributing

Look at the following transformations:

Q1. If you do a preview on the steps named Preview, which of the following is true?

  1. The number of rows you see in (a) is greater than or equal to the number of rows you see in (b).
  2. The number of rows you see in (b) is greater than or equal to the number of rows you see in (a).
  3. The dataset you see in (a) is exactly the same you see in (b) no matter what data you have in the Excel file.
Tip

You can create a transformation and test each option to check the results for yourself. To be sure you understand correctly where and when the rows take one or other way, you can preview every step in the transformation, not just the last one.

主站蜘蛛池模板: 周口市| 雅江县| 渭南市| 巩义市| 稻城县| 肇庆市| 宁蒗| 陇南市| 应用必备| 侯马市| 通州市| 清水河县| 宁武县| 罗源县| 花莲市| 区。| 浦北县| 临朐县| 缙云县| 贡山| 内乡县| 奈曼旗| 井陉县| 六盘水市| 东阿县| 阿图什市| 三亚市| 福州市| 双流县| 将乐县| 博罗县| 永宁县| 南开区| 济源市| 邵阳县| 兰坪| 桦甸市| 南丹县| 称多县| 沙田区| 邮箱|