SPFilterNode("z:\\row,row") -- Line of code being skipped

Posted on 2014-03-13
Last Modified: 2014-03-14
I have part of an overall AJAX display code that I have been asked to modify. I am trying to figure this out without help for the last 3 hours but now I am stuck.  Most of the code is working fine and no errors are getting triggered anywhere. However, when this filter component goes to search through the data nothing happens and none of the ows variables get populated.

Please keep in mind this is part of a lot of other code but I am starting with the section that is causing the issue.

Through debugging I determined the line of code that is not working as expected is:

$(xData.responseXML).SPFilterNode("z:\\row,row").each(function(index, value) {

Open in new window

Large function below--- I am wondering if it is something behind the scenes - perhaps a reference to the appropriate jquery js file but again no error is getting triggered.

function GetCensusRegionTargets (Company, TargetStart, TargetEnd) {
	//Used to get the target information for the individual census regions
	var ows_FieldItem, ows_SpeakerItem, ows_TargetStart, ows_TargetEnd;
	//Cleaning up the target start and end dates by removing trailing information
	TargetStart = TargetStart.substr(0 , TargetStart.indexOf("T"));
	TargetEnd = TargetEnd.substr(0 , TargetEnd.indexOf("T"));

	//Executing a web service call (using SPServices) to get all the census region target information
		operation: "GetListItems",
		async: true,
		webURL: "/prd/hcctesting/risk/",
		listName: "Observation Targets",	
		completefunc: function (xData, Status) {
			//console.log("GetListItems operation: " + xData.responseText);		

			//Once the web service call is completed, then we iterate through the items to find a value that matches the current Company
			$(xData.responseXML).SPFilterNode("z:\\row,row").each(function(index, value) {
	      		//console.log(index + " : " + encodeURI($(value).attr("ows_Title")));
				//Cleaning the start and end dates from the web service call to remove trailing info
				ows_TargetStart = $(value).attr("ows_TargetStart");
				ows_TargetStart = ows_TargetStart.substr(0, ows_TargetStart.indexOf(" "));

				ows_TargetEnd = $(value).attr("ows_TargetEnd");
				ows_TargetEnd = ows_TargetEnd .substr(0, ows_TargetEnd .indexOf(" "));
				//ows_OMJPICIATarget = $(value).attr("ows_OMJPICIATarget");
				//Checking to see if the observation type is a field or speaker
				if ($(value).attr("ows_ObservationType") == 'Field Observation') {			

					//Cleaning the speaker/franchise name from the web service call to remove leading info
	      			ows_FieldItem= $(value).attr("ows_TargetCompany");
					ows_FieldItem= ows_FieldItem.substr(ows_FieldItem.indexOf("#") + 1, ows_FieldItem.length);
	      			if ((Company == ows_FieldItem) && (TargetStart == ows_TargetStart) && (TargetEnd == ows_TargetEnd))  {	
	      				//console.log("Match Found (field): " + FranchiseSpeaker );
						//LEAVING to append target values

						//Breaking the each loop
						return false;

				} else if ($(value).attr("ows_ObservationType") == 'Speaker Observation') {
					//Cleaning the speaker/franchise name from the web service call to remove leading info
	      			ows_SpeakerItem = $(value).attr("ows_TargetSpkBureau");
					ows_SpeakerItem = ows_SpeakerItem .substr(ows_SpeakerItem .indexOf("#") + 1, ows_SpeakerItem .length);
	      			if ((Company == ows_SpeakerItem) && (TargetStart == ows_TargetStart) && (TargetEnd == ows_TargetEnd))  {	
	      				//console.log("Match Found (speaker): " + FranchiseSpeaker );
						//LEAVING to append target values

						//Breaking the each loop
						return false;



			//LEAVING to calculate the Gap values in the sub-details page
			CalculateSubDetailsGapValue ("ost-SubDetailsTable",true)
			//Setting the jQuery UI tool tips

Open in new window

Question by:aehrenwo
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

Robin Hall earned 500 total points
ID: 39929974
I use similar code in my sharepoint server to pull information from a SharePoint list and put it into a Visual Slider.  However I don't use SPServices (wasn't aware of it at the time I wrote the code)

I looked around a bit for SPServices functionality and came across this article which deals with the .SPFilternode portion:  SPServices Stories

In it, he uses the .SPFilterNode but his formatting is different than the line you use.  I'll past the relevant code bit below:


Maybe you can try to change your section after .SPFilterNode to look like the above.  You can read the article I included for more information.  Within the code that I use for my Slider, my z information looks like so:  .("z\\:row").

It might be worth trying both methods.

Author Closing Comment

ID: 39929985
Thanks the first option worked.

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
sharepoint list help 2 53
C# LINQ ForEach() question 6 117
Sharepoint 2013 edit permissions powershell 8 58
JVM error from eclipse 1 27
Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

739 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