For each loop container executing multiple times....
Hi,
We are using SQL SERVER version 2005.
I am having a For each loop container and inside that container there are multiple Sequence containers and inside each sequence containers there are Execute SQL Tasks (which are just stored procedures).
Now, when i run sequence containers individually they are running perfectly fine.
But when I run the whole For each loop container, it is just running and running multiple times without ending the process.
I really couldnt figure out what would be the issue?
Any ideas????
Thanks....
Hi grk666,
To check whether the values stored in the object type variable are correct, you can disable all the Sequence Containers within the Foreach Loop Container, and add a Script Task with the following code to display the string type variable value (supposing
you use the string type variable StrVar to store the value retrieved from the object variable):
MsgBox(Dts.Variables(“StrVar”).Value.ToString())
It would be helpful if you could post a screenshot to show the package execution at runtime in BIDS.
Regards,
Mike Yin
TechNet Community Support
Similar Messages
-
Package Help needed For each Loop container
Hello all,
I need a bit of advice, I`m a newbee to SSIS so I`m learning. Here`s what I need. I have a EDI 837 file which needs to be converted and inserted into a sql table. These are multiple files and I need to maintain them with a monthly load. So I have a source
folder where these files will be dumped. I created a Package which will grab the files process the EDI aspect inserts into the data into table. This is the story on a high level.
Here`s what I did.
Created a For each loop container.
I have a stored proc which takes in a 837 files and gets the fields what I want and it inserts it into a staging table from there I have a data flow task which pipes it into my production table.
Inside the loop first task is to exec the Stored Proc but my question is once a file is picked up from for each loop I need the file to be inserted into a table which I am referencing in my store proc. All the EDI conversion takes place in my SP and it references
the table..
My question is the For each loop container picks up the files but where does the data goes?? Can someone help me out
FMThe foreach loop container (file enumerator) only returns the filename or filepath which you can use as a parameter in an Execute SQL Task or within an expression on a connection manager (which can be used in a Data Flow). So it doesn't do anything with
the file. You have to add a task within the loop to do something with the file (Execute SQL Task/Data Flow Task/File System Task/etc.).
Please mark the post as answered if it answers your question | My SSIS Blog:
http://microsoft-ssis.blogspot.com |
Twitter -
Hello All,
I have some files within sub folders. Below is the layout
C:\Source\01012015\Sample_1.csv
C:\Source\01012015\Sample_2.csv
C:\Source\02012015\Sample_1.csv
C:\Source\02012015\Sample_2.csv
C:\Source\03012015\Sample_1.csv
C:\Source\03012015\Sample_2.csv
I want
to copy entire folder contents from source to destination including the sub folders and the files
I am using for each loop container which reads the files form 01012015 folder, is there any way to read
all the files from each and every folder(01012015, 02012015,03012015)?
The destination should be like this.
C:\Archive\01012015\Sample_1.csv
C:\Archive\01012015\Sample_2.csv
C:\Archive\02012015\Sample_1.csv
C:\Archive\02012015\Sample_2.csv
C:\Archive\03012015\Sample_1.csv
C:\Archive\03012015\Sample_2.csv
Thanks, Shyam.Hi Shyam,
According to your description, you want to copy entire folder contents including the sub folders and the files from source to destination.
Based on my research, we should use Foreach File Container together with File System Task to achieve your requirement. For more details, please refer to the following links:
https://social.msdn.microsoft.com/forums/sqlserver/en-US/4d99ebef-df43-44ad-9794-1d729cbf52e9/ssis-foreach-loop-copy-within-subfolders
http://www.sql-programmers.com/for-each-loop-container.aspx
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
Is there a way in a foreach loop container to exit if the foreach loop container has been executing for a certain amount of time?
Thanks.Hi miguelh,
Based on my research, there is no such a property for Foreach Loop Container to achieve this requirement. Because the Foreach Loop Container itself execute the times based on the files loop.
After testing the issue in my environment, we can add a Script Task inside the top of Foreach Loop Container to count the execute times, then add a precedence constraint with the count times on your tasks to limit the execute times. For more details, please
see:
Add a variable named Count in the package.
Drag a Script Task inside the top of Foreach Loop Container.
Double-click the Script Task, change ScriptLanguage to Microsoft Visual Basic 2010, then add User::Count as ReadOnlyVariables.
Click Edit Script to add the code like below:
Public Sub Main()
' Add your code here
Dts.Variables("User::Count").Value = Dts.Variables("User::Count").Value + 1
Dts.TaskResult = ScriptResults.Success
End Sub
Add a precedence constraint with Constraint options below:
The following screenshot is for your reference:
Thanks,
Katherine Xiong
If you have any feedback on our support, please click
here.
Katherine Xiong
TechNet Community Support -
I have a package that inserts data from multiple flat files and it also captures the file name from the path. I have qualified in the enumerator to pick only files with *.BID extension from the source folder, However What I want is if there`s a file with
lets say .txt extension after the package is run it should move the incorrect files into another folder and send out an alert email to the team.
How can i capture this kind of functionality
FMPatrick So I Just tested it again now. So in The Folder .bid files belong but there`s a high risk of getting .277 and .101 only
For Each loop container1 will only Pick .BID files and Archive it
For Each loop Container2 will only look for files with .277 and via system task moves it to a Folder "Error_File_Folder"
For Each loop Container3 will only look for files with .101 and via system task moves it to a Folder "Error_File_Folder"
This is high level of my package
For Each loop container1 will only Pick .BID files and Archive it, for every .BID file thats Archived I am caputring filename via FileName Variable and Inserts into a Table, I have a Data flow Task to Substring the Filename and sends it to a OLE DB
Destination Table.
Rest of the 2 Loop containers are only to grab .277 & .101 Files and just send it to a different folder via System task and alert the user.
I`ve successfully Ran my Package I have 7 .BID Files m 3 .277 and 3 .101 Files.. Everything appears where they need to.
FM -
SSIS Help For each Loop Container
I need a little help with this process that I am developing. I am fairly new to SSIS so please bear with me. I have done research online so If I seem limited in my knowledge please apologize me.
Requirement: I have a folder where we will have flat files monthly they could be one or more...
each file will have the following name standard "123456.EEAKQ2.EASDREWA12A.BID".
What I need to do is maintain a table which will have filename and date when it was added to the folder.
I have created a package with the following components "For each loop" which grabs files from a source folder.
This is where I am stuck. I need to grab the file name from the path and insert it into the table.
Can someone help me with this?
Thank you
FM
FMSee similar requirement implemented here
What you need is to declare and use a variable inside for each loop to get filename each time. Then you may use script task to check for pattern within the file for identifying correct files
http://visakhm.blogspot.in/2012/05/package-to-implement-daily-processing.html
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
SQL Agent Permssions With SSIS for each loop not looping through files
Hi I am Having trouble getting a ssis package to iterate through a file directory using a proxy account set up in Sql Server.
So I have a package that loops over csv files. If I run the package manually or set the sql agent job to run as Sysadmin the pakage runs fine all files are processed.
However if I use the proxy account. the package completes but no files are processed. there are no failures, there is no error handling set up in the control flow. the for each loop container simply does not recognise any files when run under a proxy.
Note: the proxy is set up with credentials to access the folder. the credential is also set up with the server admin server role... still nothing
i'm not sure is this is a ssis or permissions problem?
Any comments will be appreciatedCan you check this and see if you've configured all the steps correctly
http://www.mssqltips.com/sqlservertip/2163/running-a-ssis-package-from-sql-server-agent-using-a-proxy-account/
Also enable logging in package and see if you're getting any error messages obtained in output table/file based on the logging option you chose.
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Count the no of irritation in for each loop
I want to count no of irritation in the for each loop container.
Thank you for the help.If I were using C#, I would do something like that:
First I would define another counter variable
int anotherCounter=0;
then, in for each loop I would parse your text by splitting from the pipe characters. If it matches the value I want, i simply increment the counter.
string[] strColumnArr = strLine.Split("|".ToCharArray());
if (strColumnArr.Length > 0)
if (strColumnArr[1] == "myValue") anotherCounter++;
smalkim - MCT, MCSD, MS, MCPS -
Excel Sheet Looping: For each loop from variable Enumerator
Hi,
Is it possible to do excel sheets looping using For each loop Enumerator as "For Each loop from Variable enumerator" ? If yes, please help.
Also,
I have an excel file with 10 sheets, but want to loop only 5 sheets. Please help..how can i achieve this.
Actually i tried with
1> stored the 5 sheets name into a variable (say 'SheetsName') of type string using script task
2> For each loop container
enumerator - 'For each ADO Schema Rowset enumerator'
connection: ADO
schema: 'Tables'
variable mapping: 'User::SheetsName'
3> Within For each loop container added a data flow task
4> Inside DFT - excel source -
Data access Mode: 'Table Name or view name variable'
Variable Name: 'SheetsName'
but this loops through all the 10 sheets irrespective of only 5 sheets names stored in the variable "SheetsName".
Please help...
Please Mark as Answer if my post solved your problem or Vote As Helpful if this helps. Blogs: www.sqlserver2005forum.blogspot.com>> Is it possible to do excel sheets looping using For each loop Enumerator as "For Each loop from Variable enumerator" ? If yes, please help.
I don't think so. To loop through all worksheets of Excel For ADO.NET Schema Rowset Enumerator is the only option.
Please refer:
https://msdn.microsoft.com/en-us/library/ms345182(v=sql.110).aspx
>> I have an excel file with 10 sheets, but want to loop only 5 sheets
So you have configured For Each loop container which loops throgh all sheets and returns you sheet name to variable "SheetName".
Drag and drop one Sequence Container inside ForEach Loop Container and connect it to Data Flow Task.
Right click on connector and use expression: (which will check if current sheet is one of 5 required sheets)
@User::SheetName == "FirstSheet" || @User::SheetName == "SecondSheet" || .....
Below blog demonstrates kind of simillar steps:
http://www.bidn.com/blogs/MikeDavis/ssis/559/ssis-skip-certain-files-in-a-for-each-loop
-Vaibhav Chaudhari -
For-each loop atom not executing in B1if processing step
Dear All,
I have designed scenario in B1if in which Inbound is SAP ERP(ECC) IDOC and Outbound is UDO object. In this scenario I have loop placed in it, on the basis of IDOC fields I am executing query but it's not going inside the loop, I have entered correct path in loop. Please see attached image of processing, for loop path and inbound message.
for-each path : /vpf:Msg/vpf:Body/vpf:Payload[./@Role='S']/ZSD_IDOC_B1_JW_ASN/IDOC/ZSD_SEG_B1_ASN_SO
Inbound Message :
- <Payload Role="S" mode="0">
- <ZSD_IDOC_B1_JW_ASN xmlns="">
<?msgid 150402232456625499260A1301F349C4?>
- <IDOC BEGIN="1">
- <EDI_DC40 SEGMENT="1">
<TABNAM>EDI_DC40</TABNAM>
<MANDT>120</MANDT>
<DOCNUM>0000000000425819</DOCNUM>
<DOCREL>731</DOCREL>
<STATUS>30</STATUS>
<DIRECT>1</DIRECT>
<OUTMOD>2</OUTMOD>
<EXPRSS />
<TEST />
<IDOCTYP>ZSD_IDOC_B1_JW_ASN</IDOCTYP>
<CIMTYP />
<MESTYP>ZSD_MSG_B1_ASN</MESTYP>
<MESCOD />
<MESFCT />
<STD />
<STDVRS />
<STDMES>ZSD_MS</STDMES>
<SNDPOR>SAPJED</SNDPOR>
<SNDPRT>LS</SNDPRT>
<SNDPFC />
<SNDPRN>JED120</SNDPRN>
<SNDSAD />
<SNDLAD />
<RCVPOR>B1IFPORT</RCVPOR>
<RCVPRT>LS</RCVPRT>
<RCVPFC />
<RCVPRN>B1IFSYS</RCVPRN>
<RCVSAD />
<RCVLAD />
<CREDAT>20150402</CREDAT>
<CRETIM>175415</CRETIM>
<REFINT />
<REFGRP />
<REFMES />
<ARCKEY />
<SERIAL>20150221173915</SERIAL>
</EDI_DC40>
- <ZSD_SEG_B1_ASN_SO SEGMENT="1">
<SO_CREATE_DATE>04000205</SO_CREATE_DATE>
<DELIVERY_DATE>04000205</DELIVERY_DATE>
<CARD_CODE>04000205</CARD_CODE>
<CARD_NAME>04000205</CARD_NAME>
<SO_POSTING_DATE>04000205</SO_POSTING_DATE>
<CUST_REF_NO>04000205</CUST_REF_NO>
<PO>04000205</PO>
<PO_ITEM>04000</PO_ITEM>
<PO_MATERIAL>0400020504000205</PO_MATERIAL>
<PO_QUANTITY>040002050400020</PO_QUANTITY>
<PO_UOM>400</PO_UOM>
<BOM_COMPONENT1>04000205</BOM_COMPONENT1>
<BOM_COMPONENT2>04000205</BOM_COMPONENT2>
<_--357F4>04000205</_--357F4>
<ITEM_CODE>04000205</ITEM_CODE>
<ITEM_NAME>04000205</ITEM_NAME>
<QUANTITY>04000205</QUANTITY>
<GROSS_WT>04000205</GROSS_WT>
<NET_WT>04000205</NET_WT>
<PCSPERPKT>0400020504000205</PCSPERPKT>
<CUST_REQ_PKTWT>04000205</CUST_REQ_PKTWT>
<ECC_BATCH>04000205</ECC_BATCH>
<ECC_BATCH_QUALITY>04000205</ECC_BATCH_QUALITY>
<SO_NO>04000205</SO_NO>
<SO_ITEM>040002</SO_ITEM>
- <ZSD_SEG_B1_ASN_CHARS SEGMENT="1">
<S_PROD_TYPE>S_CRCACF</S_PROD_TYPE>
<S_PROD_FORM>S_CRCACF</S_PROD_FORM>
<S_PLANT>S_CRCACF</S_PLANT>
<S_SUB_CON_SENDING_MAT>S_CRCACF</S_SUB_CON_SENDING_MAT>
<S_JSW_GRADE>S_CRCACF</S_JSW_GRADE>
<S_THICK_MM>S_CRCACF</S_THICK_MM>
<S_WIDTH_MM>S_CRCACF</S_WIDTH_MM>
<S_EQ_SPEC>S_CRCACF</S_EQ_SPEC>
<S_UNITISATION>S_CRCACF</S_UNITISATION>
<S_EDGE_CON>S_CRCACF</S_EDGE_CON>
<S_COIL_ID_MM>S_CRCACFS_CRCACF</S_COIL_ID_MM>
<S_PACKAGING_TYPE>S_CRCACF</S_PACKAGING_TYPE>
<S_OIL_TYPE>S_CRCACF</S_OIL_TYPE>
<S_OILING_CODE>S_CRCACF</S_OILING_CODE>
<S_OIL_REQ>S_CRCACF</S_OIL_REQ>
<S_END_APPN>S_CRCACF</S_END_APPN>
<S_INT_EDGE_CON>S_CRCACF</S_INT_EDGE_CON>
<S_SKINPASS_REQ>S_CRCACF</S_SKINPASS_REQ>
<S_SURFACE_FINISH>S_CRCACF</S_SURFACE_FINISH>
<S_ROUGHNESS_CODE>S_CRCACF</S_ROUGHNESS_CODE>
<S_TOL_TYPE>S_CRCACF</S_TOL_TYPE>
<S_THICK_TOL_TYPE>S_CRCACF</S_THICK_TOL_TYPE>
<S_THK_TOL_MM_UPPER>S_CRCACF</S_THK_TOL_MM_UPPER>
<S_THK_TOL_MM_LOWER>S_CRCACF</S_THK_TOL_MM_LOWER>
<S_WDTH_TOL_MM_UPPER>S_CRCACF</S_WDTH_TOL_MM_UPPER>
<S_WDTH_TOL_MM_LOWER>S_CRCACF</S_WDTH_TOL_MM_LOWER>
<S_LENGTH_TOL_MM_UPPER>S_CRCACF</S_LENGTH_TOL_MM_UPPER>
<S_LENGTH_TOL_MM_LOWER>S_CRCACF</S_LENGTH_TOL_MM_LOWER>
</ZSD_SEG_B1_ASN_CHARS>
</ZSD_SEG_B1_ASN_SO>
- <ZSD_SEG_B1_ASN_SO SEGMENT="1">
<SO_CREATE_DATE />
<DELIVERY_DATE />
<CARD_CODE />
<CARD_NAME />
<SO_POSTING_DATE />
<CUST_REF_NO />
<PO />
<PO_ITEM />
<PO_MATERIAL />
<PO_QUANTITY />
<PO_UOM />
<BOM_COMPONENT1 />
<BOM_COMPONENT2 />
<_--357F4 />
<ITEM_CODE />
<ITEM_NAME />
<QUANTITY />
<GROSS_WT />
<NET_WT />
<PCSPERPKT />
<CUST_REQ_PKTWT />
<ECC_BATCH />
<ECC_BATCH_QUALITY />
<SO_NO />
<SO_ITEM />
- <ZSD_SEG_B1_ASN_CHARS SEGMENT="1">
<S_PROD_TYPE />
<S_PROD_FORM />
<S_PLANT />
<S_SUB_CON_SENDING_MAT />
<S_JSW_GRADE />
<S_THICK_MM />
<S_WIDTH_MM />
<S_EQ_SPEC />
<S_UNITISATION />
<S_EDGE_CON />
<S_COIL_ID_MM />
<S_PACKAGING_TYPE />
<S_OIL_TYPE />
<S_OILING_CODE />
<S_OIL_REQ />
<S_END_APPN />
<S_INT_EDGE_CON />
<S_SKINPASS_REQ />
<S_SURFACE_FINISH />
<S_ROUGHNESS_CODE />
<S_TOL_TYPE />
<S_THICK_TOL_TYPE />
<S_THK_TOL_MM_UPPER />
<S_THK_TOL_MM_LOWER />
<S_WDTH_TOL_MM_UPPER />
<S_WDTH_TOL_MM_LOWER />
<S_LENGTH_TOL_MM_UPPER />
<S_LENGTH_TOL_MM_LOWER />
</ZSD_SEG_B1_ASN_CHARS>
</ZSD_SEG_B1_ASN_SO>
</IDOC>
</ZSD_IDOC_B1_JW_ASN>
</Payload>Hi Bastian,
Thanks for response.
In Graphical For-Each Loop I have used xpath </vpf:Msg/vpf:Body/vpf:Payload[./@Role='S']/ZSD_IDOC_B1_JW_ASN/IDOC/ZSD_SEG_B1_ASN_SO> and its correct as per the input message which I have shown in discussion, please correct me if I have done wrong inn xpath expression.
As per my understanding I can not write loop in xslt because on the basis of some fields I am querying from database, if there is another way to achieve this please let me know.
Thanks -
For Each Loop Load Dynamic Excel Files
Hi All,
SSIS 2005
I want to load excel file .xls one at a time files that have different names without having to select the file in the connection manager, every time. So a user can easily place the excel file in the folder and right the sql job and it loads the file data.
The data flow tasks all work when I manually select the excel file, but I am unable to get this to work dynamically.
I have setup a for each loop with multiples data flow tasks and sql tasks to load my data from file.
Variables:
@filename d:\new file\*.xls
For Each Loop:
ForEachFile Enumerator
Folder: d:\new file\
Files: *.xls
Retrieve File Name: Fully Qualified
Variable Mappings:
User::filename (index 0)
Connection Managers:
Excel Connection Manager: Expressions, ConnectionString @[User::filename]
Error Message: Error at new buyer(package name) the connection string format is not valid. it must consist of one or more components of the form X=Y, seperated by semicolons.
Can anyone assist thanks.You still need the file name variable.
ExcelFilePath is the fully qualified file name of your Excel file. ie. it contains both the path and file name.
e.g. D:\inbox\myExcelFile.xls
All the steps you mentioned are correct, except you need to set the property of ExcelFilePath of the Excel connection to the variable that you map to in the ForEach Loop:
Connection Managers:
Excel Connection Manager: Expressions, ExcelFilePath @[User::filename]
Hope this helps.
~ J. -
Loading accdb file using for each loop in to single target table
I have 3 accdb file as below in single folder, in control flow I have created a for each loop to loop through all the below file. In dataflow task I have created oledb source using connection manager to point to first file a1.accdb. I am trying
to load all the file into single below mentioned target table, here It is only loading first file it is not looping through other two file.
This I have tried to load .txt files and csv files it is working perfectly but similarly when I try to load access db file table it is not working, can any one of you help me?
1. a1.accdb contains only one table a1tab ( col1 col2 col3 )
2. a2.accdb contains only one table a2tab ( col1 col2 col3 )
3. a3.accdb contains only one table a3tab ( col1 col2 col3 )
I have a target table with similar structure as source
Target table <TargetTable> Col1 Col2 Col3
aakThanks Arthur, please find below response
How do you handle the different table names? Cant we handle it in a similar manner, how we handle the .csv/.txt files with different name and similar structure for sources(multiple files) and target (single table)
Is it good to drop the idea of for each loop and create a separate task for each accdb file? to be loaded to same target table( performance wise etc.. any justification would be helpful)
You must handle the connection string dynamically?
Can you help me with the logic for handling connection string dynamically
aak -
Hello Everyone,
Please assist with a step by step guide on how to setup a For Each Loop for XML Task
I'm trying to convert XML to XSLT
I have tried more than 10 times and i just do not know what i am doing wrong - no error, my package just runs for a few seconds but nothing happens
Thanks in advance
DeeI managed to get my XML to XSLT to work but now when i run my package to import the data into SQL table,
it stops after a few records, i get the following error:
[XML Source [1]] Error: The component "XML Source" (1) was unable to process the XML data. The element "Errors" cannot contain a child element. Content model is text only.
Please assist
Check this:
http://social.msdn.microsoft.com/Forums/en-US/80726e0c-9e85-43ca-87bc-7cf90fd7fb31/xml-source-data-flow-throws-cannot-contain-a-child-element-content-model-is-text-only-error?forum=sqlintegrationservices
Chaos isn’t a pit. Chaos is a ladder. Many who try to climb it fail and never get to try again. The fall breaks them. And some are given a chance to climb, but they refuse. They cling to the realm, or the gods, or love. Illusions. Only the ladder is real.
The climb is all there is. -
How to use for each loop in XSLT when my source is a multilayout file and db
How do I use a for each loop in XSLT when my source is multilayout file and db .
My multilayout file is basically contain 2 kind of data one for employee and another for dependent.
Now my requirement is I want to read each line of data whether it is it is employee or dependent do a join with db and write it in my target file.
eg : File content
1 RichaKumari 311289 TCS INDIA
2 KiarnKumar 456782 BRO RichaKumari 311289 INDIA
2 Ravi 456882 BRO RichaKumari 311289 INDIA
eg : db Content
311289 RichaKumari TCS INDIA Bangalore [email protected]
Now in Final File I need something like this :
1 RichaKumari 311289 TCS INDIA
2 KiarnKumar RichaKumari 311289 TCS INDIA
2 Ravi RichaKumari 311289 TCS INDIA
here 1 and 2 are the identifier which will decide which layout to follow .Hi,
I think you'll need two nested for-each's... Something like...
<xsl:for-each select="$root/row[layout = 1]">
<xsl:variable name="employee" select="."/>
... write employee ...
<xsl:for-each select="$root/row[layout = 2 and dependentid = $employee/id]">
... write dependent ...
</xsl:for-each>
</xsl:for-each>
Cheers,
Vlad -
"for each" loop - under the hood question
Question about the for each loop. Is it optomized? I think this is a poor use of memory management -
for (int i = 0; i < stop; i++) {
Object obj = new Object();
doSomething(obj);
}And this is the ideal, using the same object -
Object obj = new Object();
for (int i = 0; i < stop; i++) {
doSomething(obj);
}So underneath the hood, which is the for each loop comparable to? I love the syntax, it's very clean-looking in the code, but at the same time I don't want to hurt performance.Question about the for each loop. Is it optomized? I
think this is a poor use of memory management -
for (int i = 0; i < stop; i++) {
Object obj = new Object();
doSomething(obj);
}And this is the ideal, using the same object -
Object obj = new Object();
for (int i = 0; i < stop; i++) {
doSomething(obj);
}So underneath the hood, which is the for each loop
comparable to? I love the syntax, it's very
clean-looking in the code, but at the same time I
don't want to hurt performance.That depends on YOU. You CANNOT write a for-each loop for the code you provided. A for-each loop requires an Iterable. (I think that's what it requires--it at least requires something to iterate over, not just an index variable as you have.)
Consider the following, however:
Object o1 = new Object();
for (Foo foo : fooList) {
Object o2 = new Object();
foo.doStuff(o1, o2);
} It will be equivalent to this:Object o1 = new Object();
for (Iterator iter = foo.iterator(); iter.hasNext();) {
Foo foo = (Foo)iter.next();
Object o2 = new Object();
foo.doStuf(o1, o2);
} How could it be any different? It has to keep the behvior of the "old fashioned" iteration.
Maybe you are looking for
-
Ipod 4th generation can't reset or restore due to forgotten password
cant get into ipod as it's password protected and don't remember the password, can't restore it in itunes and can't reset it..any ideas??
-
Updated to Airport Utility 5.3.2 - now can't see my time capsule disk!
I updated to 5.3.2 of the Airport Utility through software update but, after rebooting both my Mac and Time Capsule, I can now no longer access my Time Capsule's disk. Airport Utility says 'no disks found' A similar thing happened after the update to
-
How do I install Quartz Composer on my imac 7-27"??
I am trying to get into Quartz Composer and I am very confsed since imac 7-27' doesn't come with a cd-instal anymore. I tried to do online, installing xcode 4 from the apple site, but at some point it says that i never used itunes store and ask me fo
-
Creating .pdf file from images organized in chronological order
I have many sets of old scanned .TIFF files pertaining to corresponding documents that I would like to get organized into .pdf files. The problem is that these files were given random names when they were scanned into a proprietary database. However
-
Package Load Failure message in VS 2005 and Error: WIJ 20002
After installing BusinessObjects Enterprise XI 3.1 .NET SDK when ever I open any project in VS 2005 I get the error message (the same happened on other system as well) Package Load Failure Package 'BusinessObjects.Enterprise.Vsip.BOEVsPackage, BOEVsP