Skip to main content

BimlExpress Preview Pane

What the Preview Pane Does

The BimlExpress preview pane shows the expanded Biml that the engine produces from the file in the editor. Before this feature, getting the same view required writing the RootNode out to a text file. The pane removes that detour and updates on demand.

When a Biml file is opened, the editor splits horizontally with the preview underneath. The Hide button at the lower left collapses the pane when more vertical space is needed for the source. The Update button at the lower right refreshes the preview with the latest expansion.

Plain Biml Preview

For a static Biml file with no scripting, the preview matches the source one to one. Nothing is being expanded, so the engine has nothing to substitute. The example below produces a preview that is identical to the file it is generated from.

<Biml xmlns="http://schemas.varigence.com/biml.xsd">
<Packages>
<Package Name="PreviewSample" />
</Packages>
</Biml>

That alone is not very interesting. The value appears once BimlScript enters the picture.

BimlScript Preview

Once a code nugget is added, the preview shows the expanded output. The example below loops fifteen times to emit fifteen empty packages.

<#@ template Language="VB" #>
<Biml xmlns="http://schemas.varigence.com/biml.xsd">
<Packages>
<# for n as integer = 1 to 15 #>
<Package Name="GeneratedPkg<#= n #>" />
<# next #>
</Packages>
</Biml>

The preview shows the full set of fifteen Package nodes after expansion, which makes it obvious whether the loop and the substitutions produced what the author intended.

Using Extra Files

The preview honors other Biml files in the project. A small environment file can declare connections that the main file references during expansion.

<Biml xmlns="http://schemas.varigence.com/biml.xsd">
<Connections>
<Connection Name="StagingSrc" ConnectionString="provider=SQLNCLI11;data source=.;integrated security=SSPI;initial catalog=DemoStage" />
</Connections>
</Biml>

A second file can then read the connection from the RootNode and emit T SQL through GetDropAndCreateDdl.

<#@ template language="VB" #>
<# Dim src As AstDbConnectionNode = RootNode.Connections("StagingSrc")
Dim importResult As ImportResults = src.ImportDB(Nothing, "DimAccount", Nothing)
for each tbl in importResult.TableNodes #>
<#= tbl.GetDropAndCreateDDL() #>
<# next #>

The preview pane displays the resulting T SQL directly. There is no need to redirect output to a file just to inspect what the script will produce.

Why It Matters

The preview pane shortens the feedback loop for any technique that uses BimlScript to generate Biml or another text format. SQL generators, package generators, and metadata driven loops all become easier to inspect, debug, and iterate on.