SSIS: Programmatically set Flat File Destination filename

Recently, I was asked to export a subset of records to uniquely named delimited files. A task easily accomplished with SSIS by using a DataFlow Task and a Flat File Destination.  In this case, however, I was required to export record groups based upon a shared sequence id.  I was required to create a separate delimited file with a distinct name for each group.  Within a Foreach Loop, which was used to loop through a set of sequence id to apply as a filter against the recordset, I added a Script Task to build the file name and set it to a string variable:

 

public void Main()
        {
			// this should be wrapped to catch errors
            Dts.Variables["strFilename"].Value = 
                Dts.Variables["Sequence"].Value.ToString()
                + ".txt";

            Dts.TaskResult = (int)ScriptResults.Success;
        }

In the DataFlow Task I added a Flat File Destination and went through the steps of the wizard to add a [delimited] text file connection.  I entered a generic name in for the filename.  Once completed, the text file connection appeared in the Connection Manager Window.  Select the text file connection, do not double click, which was created and look at the ConnectionString property in the Porperty Window.  This is where the filename is stored.  To change the filename programmatically you will need to create an expression for the text file connection.  Click the ellipse next to the Expression property and choose ConnectionString as the property and enter the variable name, which was set in the Script Task, as the expression.

 



   

Embed a YouTube Video in a BlogEngine.Net Post

As I continued to wade through and cleanse my previous posts I noticed that the tags to embed a YouTube video were stripped out.  A quick search led me to this forum discussion.  I added the line of code mentioned and now I can embed YouTube videos within my posts again. The changed code is as follows:

 

// Theme options
		theme_advanced_buttons1: "fullscreen,code,|,cut,copy,paste,pastetext,pasteword,|,undo,redo,|,bold,italic,underline,strikethrough,|,blockquote,sub,sup,|,justifyleft,justifycenter,justifyright,|,bullist,numlist,outdent,indent",
		theme_advanced_buttons2: "iespell,link,unlink,removeformat,cleanup,charmap,emotions,|,formatselect,fontselect,fontsizeselect,|,forecolor,backcolor,insertcode",
        theme_advanced_buttons3: "",
		theme_advanced_toolbar_location: "top",
		theme_advanced_toolbar_align: "left",
		theme_advanced_statusbar_location: "bottom",
		theme_advanced_resizing: true,
        theme_advanced_resize_horizontal : false,
        tab_focus: ":prev,:next",
		//>> 001 110514
        extended_valid_elements: "iframe[src|class|width|height|name|align]",
		//<< 001 110514
        //Character count

 



   

Microsoft Dynamics NAV: Check if Directory Exists

 Over the years I have spent my share of time implementing and customizing ERP systems; specifically Microsoft Dynamics Nav (Navision).  I’ve been working with Nav since version 2 and have developed a wide range of systems and enhancements.

Within the Nav “library” there isn’t an easy way to check if a directory exists.  Fortunately, we can use Automation objects. To check for the existence of a directory:

Create a variable with a DataType of Automation and a SubType of 'Microsoft Scripting Runtime'.FileSystemObject

Use the following code (where PathExists is a Boolean DataType):

CREATE(fso);
PathExists := fso.FolderExists(strPath);



   

Where are the macros in Excel 2010?

If you have used the default installation of Microsoft Excel 2010 you might have noticed that the macros commands do not appear to be readily accessible.  To access Macro options from the Ribbon you must customize the ribbon to display the Developer tab.

From the menu choose: File Options Customize Ribbon and place a check adjacent to the Developer option.



   

Switching from Blogger to BlogEngine.net

Several years ago, I started out “blogging” with Blogger.  Blogger originally offered an FTP option, which offered a great deal of flexibility.  The FTP option allowed an author to host their own blog and use the Blogger software to manage posts via FTP.  Some time ago, the announcement was made denoting the death of FTP support.  This announcement took away from my enthusiasm towards posting content as I preferred to host content locally and have a bit of flexibility in the management of content and features.

Recently I decided to dabble with the BlogEngine.Net and found it to be a great alternative.  Besides experimentation with creating custom themes and experimenting with minor code changes, my first chore was to convert my posts from Blogger to BlogEngine.Net.  Unfortunately, you can’t get there from here.  It took some time and experimentation, but I finally managed to get the posts converted.

  1. Exported the Blogger blog
  2. Created a free Wordpress.com blog account
  3. Imported the Blogger export file
  4. Exported the posts from Wordpress
  5. Removed the <atom /> elements form the export file
  6. I downloaded  WXR2BlogML (Note: I did try aaron lerch’s powershell script and couldn’t seem to get it to work with my posts) and used it to converted the file
  7. Import the converted file into BlogEngine.Net using the ClickOnce Import application

I also noticed that a lot of the source code examples converted have format issues. This actually turned out for the better as I am taking the time to remove outdated posts and clean the remaining ones.  Let's see how this works out.