Referencing Project Parameters in BIML

2019-07-13 02:58发布

问题:

I've been using Catherine W's post on creating project parameters in BIML with some luck. What I'm having a problem with though is setting the expression of a local parameter equal to the project parameter. It's most likely just an XML formatting issue, but I haven't found any examples of it out on the web and have not figured it out on my own yet. So, any suggestions would be most helpful.

Here's the definition of my project parameters that is in my environment BIML file.

<Projects>
    <PackageProject Name="ProjParams">
        <Parameters>
            <Parameter Name="AgentJobName" DataType="String"></Parameter>
            <Parameter Name="LoadType" DataType="String">Full</Parameter>
        </Parameters>
    </PackageProject>
</Projects>

Then under Packages \ Package I have the Variables. I am defining a user variable named LoadType and setting it to the package variable of LoadType in an expression. (There's something in the package that wouldn't use package parameters so I had to create a user variable) I know the reference to @[$Package::LoadType] is incorrect, but that's what I'm trying to figure out. What should it be to get BIML to put in a package parameter?

    <Variables>
        <Variable EvaluateAsExpression="true" DataType="String" IncludeInDebugDump="Exclude" Name="LoadType">@[$Package::LoadType]</Variable>

Thanks everyone!

回答1:

It's working for me

<Biml xmlns="http://schemas.varigence.com/biml.xsd">
    <Projects>
        <PackageProject Name="so">
            <Parameters>
                <Parameter DataType="String" Name="ProjectParameter" >Demo0</Parameter>
            </Parameters>
            <Packages>
                <Package PackageName="so_43721322" />
            </Packages>
        </PackageProject>
    </Projects>
    <Packages>
        <Package Name="so_43721322">
            <Parameters>
                <Parameter DataType="String" Name="PackageParameter">Demo1</Parameter>
            </Parameters>
            <Variables>
                <Variable Name="PackageParameter" DataType="String" EvaluateAsExpression="true">@[$Package::PackageParameter]</Variable>
                <Variable Name="ProjectParameter" DataType="String" EvaluateAsExpression="true">@[$Project::ProjectParameter]</Variable>
            </Variables>
        </Package>
    </Packages>
</Biml>

I create a project and a package level parameter and then create two variables within my package, each referencing the parameter (@[$Project::ProjectParameter] and @[$Package::PackageParameter])

Am I missing some nuance?



标签: ssis biml