Hi Jeff,<br>
<br>
so probably you can approach it like this:
<ol>
<li>Set a decimal global variabel "<code>TotalPOAmount</code>" to "<code>0.00</code>"</li>
<li>For the loop set a numeric global variable "<code>CurrentPO</code>" initially to "<code>0</code>"</li>
<li>Find out how many POs are there to determine the end of the loop. Using a workflow arithmetic expression you can get the count of the PO's from the keyword field, e.g. <code>Count(DW_POKeyword)</code>. Assign it to a numeric global variable called "<code>TotalPOs</code>" so you can check later if the end is reached.</li>
<li>Start the loop and get the PO number of the current run. Using a workflow arithmetic expression get the PO number from the keyword field. Use the global variable "<code>CurrentPO</code>" to return the appropriate value of this run, e.g. <code>DW_POKeyword(GV_CurrentPO)</code>. Assign it to a text global variable called "<code>CurrentPONumber</code>".</li>
<li>Get the amount of the appropriate PO by querying the document using the global variable "<code>CurrentPONumber</code>". Assign the amount to a decimal global variable "<code>CurrentPOAmount</code>".</li>
<li>Add the amount to the global variable "<code>TotalPOAmount</code>" using a workflow arithmetic expression, e.g. <code>GV_TotalPOAmount + GV_CurrentPOAmount</code></li>
<li>Add a condition to check if you need to repeat the steps 3-5, by comparing the number of "<code>TotalPOs</code>" with the number of "<code>CurrentPO</code>", using a workflow arithmetic expression, e.g. <code>GV_TotalPOs = GV_CurrentPO</code></li>
<li>if the condition is <strong>not </strong>fulfilled add <code>1</code> to the global variable "<code>CurrentPO</code>", using a workflow arithmetic expression, e.g. <code>GV_CurrentPO + 1</code> and go back to the step 3.</li>
<li>if the condition is fulfilled you are done and you can move on, for example by comparing the "<code>TotalPOAmount</code>" with the total amount of the current invoice, using a workflow arithmetic expression, e.g. <code>GV_TotalPOAmount = DW_TotalAmount</code></li>
</ol>
<br>
Needed global variables:
<ul>
<li>TotalPOAmount (decimal)</li>
<li>CurrentPO (numeric)</li>
<li>TotalPOs (numeric)</li>
<li>CurrentPONumber (text)</li>
<li>CurrentPOAmount (decimal)</li>
</ul>
<br>
Let me know if this helps!<br>
<br>
Viele Grüße / With best regards,<br>
<br>
--<br>
<br>
Gerardo Lisanti<br>
Product Manager  |  DocuWare GmbH