XPath predicate / sql join-esque statement

Hi,
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
@PR_x0020_Reference
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.
LVL 5
DhopeAsked:
Who is Participating?
 
DhopeAuthor Commented:
Think I have it
http://www.experts-exchange.com/Web/Web_Languages/XML/Q_21294193.html

count(../../../Workflow_Tasks/Rows/Row[contains(@WorkflowLink, current()/@PR_x0020_Reference)])
0
 
66866Commented:
Are you using a DVWP?
0
 
DhopeAuthor Commented:
Yes, I can add it as a joined subview but ideally I'd like to filter on the result, and the main table wouldn't know the contents of the subview that way.
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
66866Commented:
Did you try adding a parameter and passing the invoice number to the parameter?
0
 
DhopeAuthor Commented:
Would the parameter not exist for the page rather than just a row though?  (see 'code' below)

So in the first row the parameter would be PR00000010, second row would be PR00000015 etc.
Column 1     |     Column 2
---------------------------------------------------------
PR00000010   | count(tasks WHERE linked_item = PR00000010)
             |
PR00000015   | count(tasks WHERE linked_item = PR00000015)
             |
PR00000025   | count(tasks WHERE linked_item = PR00000025)

Open in new window

0
 
66866Commented:
You'll have to create an explicit "FieldRef" for the PR Reference column. Did you create that in the SPDatasource?
Here's a reference
http://mdasblog.wordpress.com/2009/04/21/displaying-columns-in-a-crosslist-dvwp/
0
 
DhopeAuthor Commented:
I'm not using Marc's crosslist dvwp.  The problem isn't displaying results, it's displaying results without creating a nested table.
In the attached picture see the faint box around each result in the remaining GBP column.  This is because it's a subview.  I can't sort on subviews though, since each subview is unrelated to the other.
0
 
DhopeAuthor Commented:
I'm not using Marc's crosslist dvwp.  The problem isn't displaying results, it's displaying results without creating a nested table.
In the attached picture see the faint box around each result in the remaining GBP column.  This is because it's a subview.  I can't sort on subviews though, since each subview is unrelated to the other.
0
 
DhopeAuthor Commented:
Sorry.  Can't seem to upload the pic, guess the firewall at work is being a bit overzealous today.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.