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