Expression constraints can be very handy in SSIS. Building upon an earlier post,
Extracting SharePoint Data using SSIS, I will show how I extended the package described in that post order to get around some issues we were having in working with WSS 2.0 lists and query timeouts.
In this situation, I do not have access to make any changes to the WSS 2.0 farm; here are two links that talk about configuring WSS 2.0 web services to potentially avoid the same timeout issue I face in this particular situation – essentially, it involves similar steps you would follow in order to enable large file support in WSS/SharePoint:
- http://office.microsoft.com/en-us/winsharepointadmin/HA011607881033.aspx
- http://blog.gavin-adams.com/2007/06/28/configuring-large-file-support
In order to avoid timeouts on a very large WSS 2.0 list, I had the script component dynamically build the CAML query that gets used in the Query element in the web method call. This essentially batches my information download from the list so that I do not face a timeout.
What I use the precedence constraint to do is determine whether the package goes on to the next step. In the picture below, I have my Script Task that is responsible for generating the XML file from the web service query – since not all queries in the query set will generate data, I want to keep the process from proceeding to the next step if the result set from the web service is null:
I have a variable in the scope of the package which is a Boolean for whether or not I retrieved a result set from the web service for the particular query. The section of code below checks the Item Count in the result set and appropriately sets my Boolean value:
Dim r As System.Xml.XmlNoder = node.SelectSingleNode("//*[local-name()='data']") //node is the result set from the web service query
Dim c As Int32c = Int32.Parse(r.Attributes("ItemCount").Value.ToString())
So if we have a positive count, then Dts.Variables("FileCreated").Value = True, which allows this operation to work on my precedence constraint:
This way the package only cleans and logs the resulting file if we had a positive return on the number of records from the web service call -- simple example on one way to use a precedence constraint in SSIS.
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5