Varun Maheshwari
Varun Maheshwari

Reputation: 31

Multiple foreach loop containers in SSIS

I am working on a package which requires multiple data flow task within multiple foreach loop containers. The issue arises when i try and run the whole package. The first data flow task within the first for each loop container executes successfully but the flow doesn't enter the other for each loop containers. the initial package looks like :

Initial Package

Initial Package(Before execution)

Package after execution

Package after execution

I want to know what changes are required to make the data flow task within the other containers to execute.(All variables have a package scope). For each loop containers are running successfully when kept in different packages.

Upvotes: 2

Views: 2282

Answers (3)

Areeba Irfan
Areeba Irfan

Reputation: 1

string[] arr = new string[] { "https://sim.oecd.org/Export.ashx?lang=En&ds=TFI&d1c=hinoecd&d2c=atg&d2cc=bp", "https://sim.oecd.org/Export.ashx?lang=En&ds=TFI&d1c=hinoecd&d2c=bhs&d2cc=bp", "https://sim.oecd.org/Export.ashx?lang=En&ds=TFI&d1c=hinoecd&d2c=bhr&d2cc=bp" }; try { string fileName = Dts.Variables["User::filename"].Value.ToString(), myWebString = null, myLocalPath = null; WebClient myWebClient = new WebClient(); foreach (string myURI in arr) { myWebString = myURI + fileName; myLocalPath = "c:\sql\" + fileName; myWebClient.DownloadFile(myWebString, myLocalPath); } Dts.TaskResult = (int)ScriptResults.Success; } catch (Exception ex) { Dts.Events.FireError(18, "The process failed", ex.ToString(), "", 0); Dts.TaskResult = (int)ScriptResults.Failure; } my code is working fine but only one url how to take different url to download files how can i d

Upvotes: -1

Austin Wagner
Austin Wagner

Reputation: 81

You might want to check to see if anything that is being done in the first for loop is causing the expressions in the other for loops to evaluate incorrectly.

Upvotes: 0

Srinivasa Rao
Srinivasa Rao

Reputation: 172

Looks like it is entering into the other for loops as well, however it is not finding right set of Files to process, please check your for collection of objects. Also you have expressions in foreach loops, so check whether they are evaluating correctly.

i.e it may have *.txt, but you don't have any such files in the folder. so only foreach loop is executing but not the data flow.

Upvotes: 2

Related Questions