Solved

XPath predicate / sql join-esque statement

Posted on 2009-05-14
9
787 Views
Last Modified: 2013-11-18
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.
0
Comment
Question by:Dhope
  • 6
  • 3
9 Comments
 
LVL 21

Expert Comment

by:66866
ID: 24397831
Are you using a DVWP?
0
 
LVL 5

Author Comment

by:Dhope
ID: 24397869
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
 
LVL 21

Assisted Solution

by:66866
66866 earned 500 total points
ID: 24397897
Did you try adding a parameter and passing the invoice number to the parameter?
0
 
LVL 5

Author Comment

by:Dhope
ID: 24402057
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 21

Assisted Solution

by:66866
66866 earned 500 total points
ID: 24412635
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
 
LVL 5

Author Comment

by:Dhope
ID: 24431620
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
 
LVL 5

Author Comment

by:Dhope
ID: 24431622
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
 
LVL 5

Author Comment

by:Dhope
ID: 24431633
Sorry.  Can't seem to upload the pic, guess the firewall at work is being a bit overzealous today.
0
 
LVL 5

Accepted Solution

by:
Dhope earned 0 total points
ID: 24501815
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

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now