Setting variable values using Transformer BimlScript



This BimlScript demonstrates setting a variable value using Transformer BimlScript, along with using the GetTag method.

published 09.07.12

last updated 05.29.13



  • LocalMerge
  • Transformers

<#@ template language="C#" hostspecific="True" mergemode="LocalMerge" addtoheadofcollections="True"#>
<#@ import namespace="Varigence.Languages.Biml.Task" #>
<Biml xmlns="">
            <!-- Set the value of a variable by using the value from various tags on the TargetNode -->
            <Variable Name="SchemaName" DataType="String" ><#=TargetNode.GetTag("SchemaName")#></Variable>
            <Variable Name="TableName" DataType="String" ><#=TargetNode.GetTag("TableName")#></Variable>
            <Variable Name="ContainerName" DataType="String" ><#=TargetNode.Name#></Variable>

This Transformer BimlScript snippet illustrates two features. The first is using the BimlScript <#= and #> tags, which mark the boundaries of an expression control block. This control block instructs the Biml compiler to execute the .NET code between the tags and insert the result directly in Biml. Thus, for the first variable, the Biml compiler will execute TargetNode.GetTag("SchemaName") and replace the BimlScript nugget with the value returned from GetTag(). In the third variable, the variable's value will be the TargetNode's name, again by using the expression control block.

The GetTag(string) method is a BimlScript addition that returns the text for an annotation whose tag matches the passed in string. Thus, for the second variable, GetTag("TableName") searches the TargetNode's annotations for the one whose tag is TableName. Once found, the method returns that annotation's text. This method is a shortcut for retrieving annotation text from a node.

You are not authorized to comment. A verification email has been sent to your email address. Please verify your account.


There are no comments yet.