For Loop
A for loop will execute the tasks a specified number of times, in other words, 10 times, or 25 times, and the number of times is specified in the definition of the container. You can use a variable to specify what that count is.
For Loop is used for looping through a number of tasks for a set number of times.
Simply :-> initialize, verify condition, increment\assign
For Each Loop
A for each loop will execute once for each item in the collection of items that it is looking at. A good example would be if users are putting an Excel file into a directory for import into the DB. We cannot tell ahead of time how many will be in the directory because a user might be late, or there might be more than one file from a given user. When we define the Foreach container, we would tell it to execute for each *.xls in the directory and it will then loop through, importing each one individually, regardless of how many files are actually there.
Foreach Loop loops through various things such as files, objects, ADO connections, etc.
Above screen shot show we have task configured for “Foreach file enumerator” which can be used to move\copy\delete file (of given file) in a given folder
Enumerator configuration:
Folder: Specify the folder path from where we need to process the files
Flies: File name (format) \ file extension
Fully qualified: File name along with location is returned.Eg: C:\Example.txt
Name and extension: The file name with its extension is returned. Eg: Example.txt
Name only: The file name without its extension is returned. Eg: Example
Variable Mapping
The result of the for loop will be assigned to the variable and its value can be used further.
Foreach File Enumerator: Enumerates files in a folder
Foreach Item Enumeration: Enumerates items in a collection, such as the executables specified in an Execute Process task.
Foreach ADO Enumerator: Enumerates rows in a table, such as the rows in an ADO recordset.
Foreach ADO.NET Schema Rowset Enumerator: Enumerates schema information about a data source.
Foreach from Variable Enumerator: Enumerates a list of objects in a variable, such as an array or ADO.NET DataTable.
Foreach NodeList Enumeration: Enumerates the result set of an XML Path Language (XPath) expression.
Foreach SMO Enumerator: Enumerates a list of SQL Server Management Objects (SMO) objects, such as a list of views in a database.
python online training
ReplyDeletepython training