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

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
	$().SPServices({
		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);
					
					console.log(ows_FieldItem);
				
	      			if ((Company == ows_FieldItem) && (TargetStart == ows_TargetStart) && (TargetEnd == ows_TargetEnd))  {	
	      				//console.log("Match Found (field): " + FranchiseSpeaker );
						
						//LEAVING to append target values
						AppendTargetValues(value)

						//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);
					
					//console.log(ows_SpeakerFranItem);
	      			if ((Company == ows_SpeakerItem) && (TargetStart == ows_TargetStart) && (TargetEnd == ows_TargetEnd))  {	
	      				//console.log("Match Found (speaker): " + FranchiseSpeaker );
						
						//LEAVING to append target values
						AppendTargetValues(value)

						//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
			$("#SDViewAJAX").tooltip();
		}
	});

Open in new window

aehrenwoTechnology AnalystAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Robin HallConnect With a Mentor Senior Web Solutions ArchitectCommented:
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:

.SPFilterNode(“z:row”)

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.
0
 
aehrenwoTechnology AnalystAuthor Commented:
Thanks the first option worked.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.