0

我正在尝试将一个 forloop 容器嵌套在另一个容器中。我不断收到不允许子元素的错误。

我如何嵌套for循环?

 <ForLoop Name="For loop for Year">
                    <PrecedenceConstraints>
                        <Inputs>
                            <Input OutputPathName="Find count of rows.Output" SsisName="No data exist" PathAnnotation="ConstraintName" EvaluationOperation="Expression" EvaluationValue="Success" Expression="@[User::CountRows]==0" />
                        </Inputs>
                    </PrecedenceConstraints>
                    <InitializerExpression>@StartYear</InitializerExpression>
                    <LoopTestExpression><![CDATA[@StartYear <= @EndYear]]></LoopTestExpression>
                    <CountingExpression><![CDATA[@StartYear = @StartYear + 1]]></CountingExpression>
                        <ForLoop Name="For loop for Month"> 
                            <InitializerExpression>@StartMonth</InitializerExpression>
                            <LoopTestExpression><![CDATA[@StartMonth <= @EndMonth]]></LoopTestExpression>
                            <CountingExpression>@StartMonth = @StartMonth + 1</CountingExpression>
                        </ForLoop>
                </ForLoop>

4

1 回答 1

2

ForLoop 是 Tasks 集合的成员。您已指定您的内部 ForLoop 是外部 ForLoop 的成员。相反,它应该是外部 ForLoop 任务集合的成员。

因此

<Biml xmlns="http://schemas.varigence.com/biml.xsd">
    <Packages>
        <Package Name="so_46415142">
            <Variables>
                <Variable Name="StartYear" DataType="Int32">2014</Variable>
                <Variable Name="EndYear" DataType="Int32">2014</Variable>
                <Variable Name="StartMonth" DataType="Int32">1</Variable>
                <Variable Name="EndMonth" DataType="Int32">6</Variable>
            </Variables>
            <Tasks>
                <ForLoop Name="For loop for Year">
                    <!--
                    <PrecedenceConstraints>
                        <Inputs>
                            <Input OutputPathName="Find count of rows.Output" SsisName="No data exist" PathAnnotation="ConstraintName" EvaluationOperation="Expression" EvaluationValue="Success" Expression="@[User::CountRows]==0" />
                        </Inputs>
                    </PrecedenceConstraints>
                    -->
                    <InitializerExpression>@StartYear</InitializerExpression>
                    <LoopTestExpression><![CDATA[@StartYear <= @EndYear]]></LoopTestExpression>
                    <CountingExpression><![CDATA[@StartYear = @StartYear + 1]]></CountingExpression>
                    <Tasks>
                        <ForLoop Name="For loop for Month">
                            <InitializerExpression>@StartMonth</InitializerExpression>
                            <LoopTestExpression><![CDATA[@StartMonth <= @EndMonth]]></LoopTestExpression>
                            <CountingExpression>@StartMonth = @StartMonth + 1</CountingExpression>
                        </ForLoop>
                    </Tasks>
                </ForLoop>
            </Tasks>
        </Package>
    </Packages>
</Biml>
于 2017-09-26T15:48:32.257 回答