Link to home
Start Free TrialLog in
Avatar of Dhope
DhopeFlag for United Kingdom of Great Britain and Northern Ireland

asked on

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.
Avatar of 66866
66866
Flag of United States of America image

Are you using a DVWP?
Avatar of Dhope

ASKER

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.
SOLUTION
Avatar of 66866
66866
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Dhope

ASKER

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

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Dhope

ASKER

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.
Avatar of Dhope

ASKER

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.
Avatar of Dhope

ASKER

Sorry.  Can't seem to upload the pic, guess the firewall at work is being a bit overzealous today.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial