Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Following solution may help you to resolve the issue.</p> <p>Use the For each loop container with <code>"Item" enumerator</code>. Since you have 10 files and if something missing you need raise then you should use this. File enumerator just iterate through the files, not raises any error.</p> <p>Following are Steps.</p> <p>Create following SSIS package with variables.</p> <ol> <li>FileFullPath</li> <li>IsValidated</li> </ol> <p>For each loop enumerator should be configured as following screenshots.</p> <p><strong>Configuartion in collection:</strong> <img src="https://i.stack.imgur.com/ddPiW.jpg" alt="enter image description here"></p> <p><strong>configuration in Variable section</strong> <img src="https://i.stack.imgur.com/jmrnj.jpg" alt="enter image description here"></p> <p>Inside the container have a script task. you have to mention the <code>FileFullPath</code> as readonly variable and <code>IsValidate</code> as read and write like the following screen.</p> <p><img src="https://i.stack.imgur.com/7OYBI.jpg" alt="enter image description here"></p> <p>Click Edit script and insert the following code.</p> <pre><code>public void Main() { Dts.Variables["IsValidated"].Value = true; string fileFullPath = Dts.Variables["FileFullPath"].Value.ToString(); if (!File.Exists(fileFullPath)) { var msg = String.Format("File is not available in location : {0}", fileFullPath); Dts.Events.FireError(0, "Dat file loading", msg, string.Empty, 0); Dts.TaskResult = (int)ScriptResults.Failure; } //Read last line String lstLine = File.ReadLines(fileFullPath).Last(); int totalCount = 0; bool talierExists = int.TryParse(lstLine, out totalCount); if (!talierExists) { var msg = String.Format("No tailer row found and last line is : {0}", lstLine); Dts.Events.FireError(0, "Dat file loading", msg, string.Empty, 0); Dts.TaskResult = (int)ScriptResults.Failure; } //Total count int fullCount = File.ReadLines(fileFullPath).Count(); if (fullCount != totalCount) { var msg = String.Format("No of count is not matching, tailer count = {0} and full count={1}"); Dts.Events.FireError(0, "Dat file loading", msg, string.Empty, 0); Dts.TaskResult = (int)ScriptResults.Failure; } Dts.Variables["IsValidated"].Value = true; Dts.TaskResult = (int)ScriptResults.Success; } </code></pre> <p>After that have your Data flow. Connect the script task with your data flow and right click on the connector and go to edit and configure as follows.</p> <p><img src="https://i.stack.imgur.com/ro3cS.jpg" alt="enter image description here"></p> <p>Your SSIS package will looks like follows.</p> <p><img src="https://i.stack.imgur.com/Q0il2.jpg" alt="enter image description here"></p> <p>Hope this helps!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload