2017-09-25 88 views
0

我試圖在另一個嵌套forloop容器。我不斷收到錯誤,該子元素是不允許的。BIML嵌套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

甲for循環是任務集合的成員。你已經指定你的內部ForLoop是外部ForLoop的成員。相反,它應該是外部ForLoop的Task集合的成員。

因此

<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>