我正在尝试将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>
答案 0 :(得分:0)
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>