Skip to main content

Split Large Biml Files with the Include Directive

Biml files have a tendency to grow large and quickly become unreadable. The '#@ include file=...#' directive splits a single Biml file into smaller pieces by pulling another file's contents inline at compile time. As a rule of thumb, keep each fragment under about 100 lines.

This snippet pulls in two existing fragments: 'FFF AdventureWorks2012 Person Address.txt' (a FlatFileFormat definition) and 'CnOleDBAdventureWorks2012.txt' (an OLE DB connection definition), then declares a 'FlatFileConnection' inline that references the imported file format by name. The dataflow that follows reads from the OLE DB source and adds a row-number column. Adjust the absolute include paths and the embedded SELECT to match your own filesystem and source table.

<Biml xmlns="http://schemas.varigence.com/biml.xsd">
<FileFormats>
<#@ include file="C:\BIML\FFF\FFF AdventureWorks2012 Person Address.txt" #>
</FileFormats>
<Connections>
<#@ include file="C:\BIML\CN\CnOleDBAdventureWorks2012.txt" #>
<FlatFileConnection Name ="CnFFAdventureWorks2012PersonAddress"
FileFormat ="FFF AdventureWorks2012 Person Address"
FilePath="C:\AdventureWorks2012.Person.Address.dat"></FlatFileConnection>
</Connections>
<Packages>
<Package Name="Add.RowNumber.Include" ConstraintMode="Linear">
<Tasks>
<Dataflow Name="DFT Add Rownumber">
<Transformations>
<OleDbSource Name ="ODS AdventureWorks2012 Person Address"
ConnectionName ="CnOleDBAdventureWorks2012">
<DirectInput>
SELECT [AddressID]

Submitted by John Minkjan.