I have two SharePoint lists. One is a list of Purchase Requests, the other is a list of workflow tasks. A workflow task references a Purchase Request.
Occasionally a workflow will fail to start correctly and the Purchase Request gets stuck as Pending despite having no active tasks.
Using SharePoint Designer I'd like to produce a table that displays Purchase Requests currently pending in the first column and the number of active workflow tasks corresponding to that invoice in the second column.
So the left column is
from the set
/dsQueryResponse/Purchase_Requests/Rows/Row[normalize-space(@PR_x0020_Status) = 'Pending']
To count the number of tasks for a specific invoice, say ISD0000140, you use the following expression
count(../../../Workflow_Tasks/Rows/Row[@TaskStatus!= 'Completed' and contains(@WorkflowLink, 'ISD0000140')])
Essentially I want to replace 'ISD0000140' with @PR_x0020_Reference, but when I do then it always evaluates to true so it just returns the total number of active tasks.
Hope that makes sense, any pointers much appreciated.