Stump the Panel: SharePoint Q&A

Immediate solutions for common SharePoint questions
It is currently Mon May 20, 2013 7:54 am

All times are UTC - 5 hours [ DST ]


Forum rules


What you are viewing is an archive of Stump the Panel. It remains for reference purposes. Please post all new questions on NothingButSharePoint.com
https://www.nothingbutsharepoint.com/sites/eusp/Forum



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Advanced filtering on DVWP
PostPosted: Tue Apr 05, 2011 1:56 pm 
Offline

Joined: Wed Nov 17, 2010 4:44 pm
Posts: 5
I have a list where I need to filter on three fields:

OnCallStack (lookup field)
OnCallActive (Yes/No)
OnCallOverride (Yes/No)

I need to always filter on OnCallStack.

Then, I need to filter on Override. If a record in the stack has Override = yes, then that's the record I want. If no record in the stack has Override = yes, then display the record (if it exists) where Active = yes.

I figured I'd have to use the XSLT Filtering, but I'm having a tough go at it and Google has been failing me.


Top
 Profile  
 
 Post subject: Re: Advanced filtering on DVWP
PostPosted: Tue Apr 05, 2011 2:14 pm 
Offline
User avatar

Joined: Sat Jan 02, 2010 4:29 pm
Posts: 589
Location: Boston, MA, USA
Filtering in CAML is always going to be more efficient, but for something like this, I often filter on the nodeset. Something like this:
Code:
<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row[
    @OnCallStack = 'foo' or
    @OnCallOverride = 'Yes' or
    (@OnCallOverride = 'No' and @Active = 'Yes')
  ]"/>

It's hard for me to tell from what you've posted exactly what you're after, but maybe this will help?

M.


Top
 Profile  
 
 Post subject: Re: Advanced filtering on DVWP
PostPosted: Tue Apr 05, 2011 3:53 pm 
Offline

Joined: Wed Nov 17, 2010 4:44 pm
Posts: 5
I've been having that issue this week (getting the WHOLE story through in one post/email).

I have a Contacts list that the whole IS department uses for internal contact info. I've added these fields to help automate the On Call rotation process (I also have a timer job that fires off daily to adjust the current On Call person). What I want to do is display a web part that displays each OnCallStack's (ie "Technical Services", "A-Team", "Cache", etc.) active member. It would be pretty straight-foward if it was just show where OnCallActive = Yes, but, if OnCallOverride for a given stack is set, then that takes precedence over any OnCallActive = Yes in the stack.

For example:

Quote:
Name --- OnCallStack --- OnCallActive --- OnCallOverride
Smith, John --- Technical Services --- Yes --- No
Sue, Betty --- Technical Services --- No --- No


This should return Smith, John as the active member on call. However, if this were the data:


Quote:
Name --- OnCallStack --- OnCallActive --- OnCallOverride
Smith, John --- Technical Services --- Yes --- No
Sue, Betty --- Technical Services --- No --- Yes


Then Sue, Betty should be the active member on call.


Top
 Profile  
 
 Post subject: Re: Advanced filtering on DVWP
PostPosted: Tue Apr 05, 2011 4:34 pm 
Offline
User avatar

Joined: Sat Jan 02, 2010 4:29 pm
Posts: 589
Location: Boston, MA, USA
Hmm. That's more complicated since you need to compare values across list items. It's definitely possible, but it'll be messy.

This isn't going to be exactly right because I can't test it, but something like this:
Code:
<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row[
    (count(="/dsQueryResponse/Rows/Row[@OnCallStack = current()/@OnCallStack and @OnCallOverride = 'Yes']) &gt; 0 and @OnCallActive = 'Yes') or
    @OnCallActive = 'Yes'
  ]"/>

M.


Top
 Profile  
 
 Post subject: Re: Advanced filtering on DVWP
PostPosted: Wed Apr 06, 2011 9:30 am 
Offline

Joined: Wed Nov 17, 2010 4:44 pm
Posts: 5
Mark,

I'm not quite following the block. When I pasted into XSL, I had issues with the (count(="/ piece. I removed the =", but I'm thinking that's an integral piece. Should there be a closing " somewhere? Maybe here: @OnCallActive = 'Yes'") or ...?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group