Solved

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

Posted on 2014-03-13
2
2,583 Views
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
	$().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

0
Comment
Question by:aehrenwo
[X]
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
2 Comments
 
LVL 5

Accepted Solution

by:
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:

.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
 

Author Closing Comment

by:aehrenwo
ID: 39929985
Thanks the first option worked.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
This article will show, step by step, how to integrate R code into a R Sweave document
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

623 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