Search first/last name with form web part & xslt variables not working

IntercareSupport
IntercareSupport used Ask the Experts™
on
I am trying to make a form web part with 2 text boxes.  I want the first text box to be able to search by first name, and the second box to search by last name.  You will be able to use either or both boxes, and do wildcard searches.

The sample code below works for the "First_Name" text box, but I can't seem to figure out how to make it work with the "Last_Name" text box.  How do I make this happen?  The full code is attached.  Thanks.

I am using Sharepoint 2007 MOSS.
<xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'" />
<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
<xsl:variable name="searchcaps" select="translate($SearchTerm, $smallcase, $uppercase)" />

<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row[contains(translate(@First_Name, $smallcase, $uppercase), $searchcaps)]"/>

Open in new window

xsl.txt
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2010

Commented:
i assume you're using this method here:
http://philwicklund.com/archive/2009/04/11/using-the-data-view-web-part-to-search-a-sharepoint-list.aspx

how did you connect your Last Name web part to the list which is to be filtered?

also, i had some problems using that method, and so i modified it.  you can see my comments and the solution to my approach by looking at Sept 17, 2009 comments at the bottom of that blog post.

Author

Commented:
You are correct.  That's a great post.

I just updated the code a bit.  I didn't send the most up to date version previously.

The Last_Name field is tied as a parameter value to input to dataview webpart.  I also just tried the code snippet below with no success.

I don't think I can use your code on that blog because my dataview comes from a list and not a table.  Let me know if I'm wrong.  Thanks.
<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row[contains(translate(@First_Name, $smallcase, $uppercase), $searchcaps) or contains(translate(@Last_Name, $smallcase, $uppercase), $searchcaps)]"/>

Open in new window

xsl.txt
Top Expert 2010
Commented:
you're correct... you won't have a SQL query line like i did.

my other suggestion is to try asking the author of that blog.  when i ran into problems, he was responsive.

Author

Commented:
Hmm.  I don't have a Facebook account.

Author

Commented:
I'm going to close this and reopen it when I return to this project.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial