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>
Annotations and comments
  • 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.
  • Input start date as string & convert to Date object
  • Loop body
  • Add additional information to course schedule
  • Nr. of iterations: 12
  • Shift date by x months
  • Add instructor & location to course
  • Convert to Date object
  • Start date: 15.01.2011
  • Create shift value from current iteration

Nodes

Extensions

Links