Icon

Exercise 2

<p><strong>Chapter 8/Exercise 2</strong></p><p>This exercise demonstrates how to implement a CASE Switch to process data differently depending on the day of the week. This is a very common task in data warehousing.</p><p>In this example, we want to process the data as follows:</p><ul><li><p>Every <strong>Wednesday</strong>, create a <em>Box Plot</em> image of the scaled price.</p></li><li><p>No processing during <strong>the weekend</strong>.</p></li><li><p>On any other day, just filter out some columns.</p></li></ul>

CASE Switch

Case 2 (port 1): Wednesday - create Box Plot image

Case 3 (port 3): And other day - filter out some columns

Get today's date (execution date)

Workflow: Chapter 8/Exercise 2


This exercise demonstrates how to implement a CASE Switch to process data differently depending on the day of the week. This is a very common task in data warehousing.

In this example, we want to process the data as follows:

  • Every Wednesday, create a Box Plot image of the scaled price.

  • No processing during the weekend.

  • On any other day, just filter out some columns.

Reading data

Creating flow variable

To control CASE Switch

Case 1 (port 0): Saturday or Sunday - do nothing

Active port dependingon current day of the week
CASE Switch Start
Visualize distributionof scaled price
Box Plot
write svg image
Image Writer (Port)
0, 1, or 2 depending on day of week
Variable Expression
Scale Priceby 1/100
Expression
keep make, aspiration, stroke, compression ratio
Column Filter
CASE Switch End
ExtractDay of Week (Number)
Date&Time Part Extractor
Convert toflow variable
Table Row to Variable
cars-85.csv
CSV Reader
Get execution date
Date&Time Range Creator

Nodes

Extensions

Links