﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Integration Services / Data Warehousing  / check contents of a text file / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Fri, 24 May 2013 10:05:58 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: check contents of a text file</title><link>http://www.sqlservercentral.com/Forums/Topic1415357-364-1.aspx</link><description>Ok,This is what we did.Package scoped variable intIsGoodToGo (Int32)For-loop with Eval Expression of 1==1 to keep the package constantly runningKonesans File Watcher looks for the file to arrive or change (we also have it set to check on start up)  On detection of a changeData Flow Task:Flat file source which is the status file we were monitoringConditional Split:  The file contains one column which we called status. CS has two output streams 'Success' with a condition of Status == "Build Success" and 'Not Success' with a condition of Satus != "Build Success"The Success stream goes to a rowcount destination which puts the rowcount into intIsGoodToGo.  In our case the result will be either 0 or 1 because the file will only ever contain one linePrecedence Contstraint from the dataflow task on task Success and Expression of @intGoodToGo == 1The package then processes until the termination point then the for-loop evaluation kicks in and waits for the next appearance of the file.  The last task before termination is to delete the file being watched for (in our case the source application will re-create it if it does not exist)Hope this is helpful to someone.</description><pubDate>Tue, 19 Feb 2013 08:33:37 GMT</pubDate><dc:creator>aaron.reese</dc:creator></item><item><title>RE: check contents of a text file</title><link>http://www.sqlservercentral.com/Forums/Topic1415357-364-1.aspx</link><description>Nice one Phil,Worked a treat.  I am up against it today but I will post a full solution later to help others.Obiron</description><pubDate>Wed, 06 Feb 2013 03:12:13 GMT</pubDate><dc:creator>aaron.reese</dc:creator></item><item><title>RE: check contents of a text file</title><link>http://www.sqlservercentral.com/Forums/Topic1415357-364-1.aspx</link><description>[quote][b]aaron.reese (2/4/2013)[/b][hr]Thanks Phil,  That was a useful lesson.Unfortunately I can't see how to assign the value to a variable without using a script.  I have tried sending the output to a new flat file but the file gets written even if there is nothing to put into it.[/quote]OK, my flippant comment about setting a variable was not very helpful - sorry.But there is a way to do this, using the same technique I mentioned. After the conditional split, put a RowCount component in the 'Success' branch and fire the result into an int variable which has been initialised as zero.At the end of the data flow, you have an int variable which is either 0 or 1 and you can use that in your precedence constraints.</description><pubDate>Mon, 04 Feb 2013 11:47:22 GMT</pubDate><dc:creator>Phil Parkin</dc:creator></item><item><title>RE: check contents of a text file</title><link>http://www.sqlservercentral.com/Forums/Topic1415357-364-1.aspx</link><description>Thanks Phil,  That was a useful lesson.Unfortunately I can't see how to assign the value to a variable without using a script.  I have tried sending the output to a new flat file but the file gets written even if there is nothing to put into it.</description><pubDate>Mon, 04 Feb 2013 11:30:33 GMT</pubDate><dc:creator>aaron.reese</dc:creator></item><item><title>RE: check contents of a text file</title><link>http://www.sqlservercentral.com/Forums/Topic1415357-364-1.aspx</link><description>Read the file in a dataflow.Add a conditional split which redirects processing according to what has been read - two outputs: Build Success and the rest.Each different path sets a variable appropriately.Destination is irrelevant - use the trash destination.Now you have a variable which you can use to decide what to do next.</description><pubDate>Mon, 04 Feb 2013 09:01:07 GMT</pubDate><dc:creator>Phil Parkin</dc:creator></item><item><title>check contents of a text file</title><link>http://www.sqlservercentral.com/Forums/Topic1415357-364-1.aspx</link><description>Guys,I am using the Konesans file watcher to watch for a file (status.txt) to change.The file contains only one line of text which will be 'Build In Progress' 'Build Failed' or 'Build Sucess'I want to monitor the contents of the file and only continue processing if the status is 'Build Success'The challenge is that I need to do it without using scripts.....:w00t:So far I am trying this - which seems a bit long winded...DataFlow Task to convert the flat file to a raw fileDataFlow Task to read the raw file into ADO recordsetForEachLoop container to read the ADO recordset and assign the value to a string variableForLoop container inside the ForEachLoop that does not process if the value != "Build Success"</description><pubDate>Mon, 04 Feb 2013 08:53:24 GMT</pubDate><dc:creator>aaron.reese</dc:creator></item></channel></rss>