Task 2.4 - Orders By Size Statistics Collector

Task Overview

In this tutorial you will again use the statistics collector to gather statistics that would not be gathered in the default settings of the model. In this case, you will get statistics on the number of orders processed but broken out based on the number of items in each order. You’ll have statistics on the throughput of orders based on size. You will do this by utilizing labels from within the statistics collector events.

This tutorial is based on the same model that was used in the Tutorial 1 of this series. For information on how to load the model, please refer to that tutorial:

Statistics Tutorial 1 - Create a Basic Statistics Collector

Step 1 Setting up the Statistics Collector

To set up the statistics collector:

  1. Click on the Toolbox tab on the left of the screen and click the button to add a new tool. Navigate to the Statistics section and select Statistics Collector. This will open a properties window.
  2. Click on the field at the top and rename the statistics collector to OrdersBySize.
  3. Open the Process Flow view if it isn’t open already. (To do this, click on the Process Flow button at the top, and select the General directory and then select Process Flow.)
  4. One thing to note in the process flow is the Set Order Size activity. Here you can see that there is a label, OrderSize, being set on the order tokens. You will use this label in the statistics collector as part of the data.

  5. Back in the statistics collector properties window, click on the Sampler button to sample for a new event. With the sampler active, navigate to the Process Flow window and click on the Sink activity. From the menu that opens, select the On Entry event.
  6. In the Row Value(s) field type data.token.OrderSize. This will use the previously mentioned OrderSize label on the token and create a unique row for each different size of order that comes through.
  7. Additionally, imagine that you only want data on order sizes that are considered “small.” This is where you can use the Condition field to filter out some results from the Row Value. For the sake of this tutorial you are only looking for orders with a size of 4 or less.

  8. Click on the Condition field and type data.token.OrderSize <= 4.
  9. Now click on the Columns tab, and click the button to create a new column.
  10. In the Name field, name this column OrderSize.
  11. In the Row Add Value field type data.rowValue.
  12. Click the Storage Type field and select the Integer option.
  13. Click the button to add another column.
  14. Name this column Output
  15. In the Row Add Value field type 0. Because you want the Output value to start at 0 at the beginning.
  16. Click the arrow next to the Event Value field and select the Data option and the Increment Data Value option.
  17. In the sub window field that opens, the default increment value should be 1, if it is not make sure it is 1 before closing it.
  18. In the Event/Column Connections field, select the Sink - On Entry event, then check the Output box in the field that says Specify which columns this event updates.
  19. Click on the Storage Type field and select the Integer option.
  20. Click the Apply Button.

Now if you right-click on the OrdersBySize collector in the Toolbox and select the View Table option you can see the table for the collector. You should be able to now see the table populate with the data on output based on order size. You may have to speed up the model runtime to see the changes.

You may notice that the table is not ordered. The first row that comes in will be based on the first order that enters the system. If you want to order the table by order size, you can use the Row Sorting feature in the statistics collector properties. To do this:

  1. In the statistics collector properties window, click on the Row Options tab.
  2. Click on the + button underneath Row Sorting.
  3. This will create a new field. By default the Sort By field should say data.rowValue, if it does not, enter that now.
  4. Click the Apply button.

Once again if you reset and run the model, you should now see that statistics collector table will be sorted by order size now.

Step 2 Creating a Chart

Now you will add a chart to chart the data collected by the OrdersBySize collector. To do this:

  1. First click the Dashboards button at the top of the screen and select the Add a Dashboard option.
  2. In the Properties on the right, click on the field Dashboard Name. Rename the dashboard to be OrdersBySize.
  3. While the dashboard view is active, navigate to the library on the left. Under the Base Chart Types section, find and drag a Bar Chart onto the dashboard. This will open the new chart’s properties window.
  4. Click on the Data Source field and select the OrdersBySize collector from the options.
  5. Click on the Data Format field and select the One bar per row option.
  6. Click on the Bar Color field and select OrderSize.
  7. Click on the Bar Size field and select Output
  8. Click on the Settings tab.
  9. Uncheck the Show Percentages box.
  10. Check the Show Zero Columns box.
  11. Click on the Text tab.
  12. Check the OrderSize box in the Show Column Headers field to make sure the OrderSize text is visible.
  13. Click the Apply button.

Now if you reset and run the model you will be able to see the chart utilizing the OrderBySize collector’s data during the runtime of the model.