PrecedenceConstraints using Transformers


Peter Avenent

A follow up on the power of using Transformers in Mist

published 05.20.14

last updated 05.21.14



  • Transformers


I'm currently working with one of our partners to convert the "BidsHelper" framework to Mist and secure their IP using Transformers. I'll post detailed instruction on that subject in the next week or two. One of the things that they do in the first task in every ControlFlow is to check a repository if the package should execute. I have seen similar approaches in various frameworks out there and provide the following code as a demonstration of how you can achieve this using a single transformer. If you are new to Transformers please refer to the BimlScript Transformers Primer.

A Simple DataFlow

<Biml xmlns="">
        <Package Name="DummyPackage" ConstraintMode="Parallel">
                <Dataflow Name="DFT - Dummy">
                        <Annotation AnnotationType="Tag" Tag="AddExecuteCheck">AddExecuteCheck</Annotation>

Add Variables to Package

<#@ target type="Package" mergemode="LocalMerge" #>
        <Variable Name="IsExecutable" DataType="String" Namespace="User">"N"</Variable>

Add Execute SQL Task to DataFlow

<#@ target type="DataflowTask" mergemode="LocalReplace" #>
<#  if (TargetNode.Annotations["AddExecuteCheck"] != null) { #>
    <ExecuteSQL Name="SQL - Execute Check" ForcedExecutionValueDataType="Empty" ConnectionName="AW" ResultSet="SingleRow">
            <Result Name="0" VariableName="User.IsExecutable" />
        <DirectInput>SELECT 'Y'</DirectInput>
<#  } #>
<#@ import namespace="System.Data"

Add PrecedenceConstraint to DataFlow

<#@ target type="DataflowTask" mergemode="LocalMerge" #>
<#  if (TargetNode.Annotations["AddExecuteCheck"] != null) { #>
    <PrecedenceConstraints LogicalType="And">
            <Input OutputPathName="SQL - Execute Check.Output" EvaluationOperation="ExpressionAndConstraint" Expression="@IsExecutable == &quot;Y&quot;" />
<#  } #>
<#@ import namespace="System.Data" #>
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.