Icon

Exercise2

<p><strong>Chapter 7/Exercise 2</strong></p><p>In this exercise, we create a course schedule for the next 12 months using a <em>Counting Loop</em>.</p><p>We are asked to schedule one course each month, the first course taking place on January 15, 2011. We use a <em>Table Creator</em> node to input the first date as a String and then convert it to a Date object. Note, that you can also create a single Date value with the <em>Date&amp;Time Range Creator</em> node (specify the start date and set the number count to 1).</p><p>Within the loop, we take the start date and shift the date by x months where x is equal to the current loop iteration. So, in the first iteration we shift the date by 0 months, then 1 month, 2 months, etc. To define the shift value we use a flow variable which we create in the <em>Variable Expression</em> node.</p><p>Lastly, after concatenating all intermediate results, we add the instructor and location to each course.</p>

Workflow: Chapter 7/Exercise 2


In this exercise, we create a course schedule for the next 12 months using a Counting Loop.

We are asked to schedule one course each month, the first course taking place on January 15, 2011. We use a Table Creator node to input the first date as a String and then convert it to a Date object. Note, that you can also create a single Date value with the Date&Time Range Creator node (specify the start date and set the number count to 1).

Within the loop, we take the start date and shift the date by x months where x is equal to the current loop iteration. So, in the first iteration we shift the date by 0 months, then 1 month, 2 months, etc. To define the shift value we use a flow variable which we create in the Variable Expression node.

Lastly, after concatenating all intermediate results, we add the instructor and location to each course.

Loop body

Input start date as string & convert to Date object

You can also create a single Date value with the Date&Time Range Creator node

Add additional information to course schedule

Start date: 15.01.2011
Table Creator
Convert toDate object
String to Date&Time
Shift date byx months
Date Shifter
Loop End
Add instructor &location to course
Expression
Create shift valuefrom current iteration
Variable Expression
Nr. of iterations: 12
Counting Loop Start
Date&Time Range Creator

Nodes

Extensions

Links