Go Premium for a chance to win a PS4. Enter to Win


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

Posted on 2014-03-13
Medium Priority
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

Accepted Solution

Robin Hall earned 2000 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
This video teaches viewers about errors in exception handling.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

916 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