Wednesday, December 28, 2016

Control Flow Tasks # – Difference between Sequence ,For Each Loop and For Loop Container Task

Why to use this task ?
The container and looping tasks allow us to repetitively run a set of tasks for a set number of times or for each element in a collection, such as all files in a folder.
We are taking about the following three task lets look :
imageimageimage
Use of Sequence Container Task
  • When we want perform some task sequentially or parallel we are going to make use of most of sequence container
  • which means though the name of the task is sequence container make point it can perform following two task:(A) Sequential execution of task (B)Parallel execution of task
  • The Sequence container groups together several tasks.
  • Use it to define a transaction boundary around a set of tasks so they all fail or succeed together. Or, use it simply to reduce the clutter on the design surface by hiding the detailed steps within the sequence.
  • We can also group control flow objects, and collapse or expand those groups. There’s no task for grouping.
  • Use of For Each Loop Container Task
  • For Each Loop container is falls under container and looping tasks
  • Use containers like the For Each Loop and For Loop to execute a set of tasks multiple times.
  • For example, you can loop over all the tables in a database, performing a standard set of operations like updating index statistics.
  • In short when we have to iteratively execute set of task we will insert all those task under For Loop Container and set the values accordingly
  • The for each loop container acts as a repeating control flow in a package. Its operations are similar to work of For each keyword in any advanced programming language. We have a definite type of enumerator for each type of objects.
  • Loop implementation in the For Each Loop Container is similar to the Foreach looping concept in various programming languages.
  • Use of For Loop Container Task
  • Name of the task itself explains most of of it !! For Loop container is falls under container and looping tasks
  • Use containers like the For Each Loop and For Loop to execute a set of tasks multiple times.
  • For example, you can loop over all the tables in a database, performing a standard set of operations like updating index statistics. 
    In short when we have to iteratively execute set of task we will insert all those task under For Loop Container and set the values accordingly
  • For loop task is the looping implementation of a task and also This task will evaluate an expression and loops through the process and until the evaluation goes to False.
Comparison between this task ?
  • Following are key point which will describe difference between above task which falls under same category
  • Use For loop task when you know exact how many time we have repeat given Data flow for execution
  • Use For Each Loop when there is dependency on no of time task should execute on data such as files,variable we will use this.
  • And when we know exact sequence and sometime we need to perform parallel operation based on our requirement.
  • With a For Each loop, we have a pre-determined number of times we will execute the loop. this could be rows in a table, files in a folder, or items in a list.
  • In a For Each loop we can specify what the list is by manipulating the properties and loop enumerator.
  • In a for loop we will execute the tasks a specified number of times, in other words n times, or 25 times, and the number of times is specified in the definition of the container
  • A for each loop will execute once for each item in the collection of items that it is looking at.

No comments:

Search This Blog

DAX - Grouping on multiple columns and the count

Please go thorugh the below URL for entire soultion. http://community.powerbi.com/t5/Desktop/DAX-Grouping-on-multiple-columns-and-the-cou...