The Challenge
I'm in the process of converting my metadata framework to use Mist Transformers instead of include files. During this process I encountered the following challenge while automating foreign key Lookups. I want to have DerivedColumns to add the -1 defaults for all foreign keys and using annotation tags will add the relevant Lookups. All the Transformer examples that I could find started with <#=TargetNode.GetBiml()#>, but I needed it to start with all the Lookups and then spit out the <#=TargetNode.GetBiml()#>.
The Solution
In the attached Mist project the Transformer in question is tf-dft-target-lkp.biml and the code is quite simple, it always is once you've figured it out.
<#@ target type="DerivedColumnList" mergemode="LocalReplace" #> <# if (TargetNode.Annotations["AddLookupTarget"] != null) { #> <Transformations> <DerivedColumns Name="DC - Test PlaceHolder"> <InputPath OutputPathName="<#=TargetNode.InputPath.ResolvedOutputPath.ScopedName#>" /> <Columns> <Column Name="<#=TargetNode.InputPath.ResolvedOutputPath.ScopedName#>" DataType="Boolean" ReplaceExisting="false">false</Column> </Columns> </DerivedColumns> <# TargetNode.InputPath.RemoveFromParent();#> <#=TargetNode.GetBiml()#> </Transformations> <# } #> <#@ import namespace="System.Data" #>
Outstanding
I still want manually hook up the new input, but after a hour of looking into InputPath.OutputPath and AddNewInput without success I'm moving on to the next challenge. I will touch base with the Varigence development team in the next week or two and will post an update if there is a better way of achieving this.
By the by
In the Mist project I have also configured the Diff Viewer Path and Arguments for WinMerge if you are interested.
Comments
There are no comments yet.