SharePoint and CAML query help

Isaac
Isaac used Ask the Experts™
on
I have created a caml query that filters based on fiscal year (2016,2017,2 etc.).  The problem that I have is the results are wrong sometimes.
Below is my CAML query
 var prjQry = "<View>"+
	    			"<Query>"+
						"<Where>"+
							"<Or>"+
							  "<Eq>"+
							  	"<FieldRef Name='Design_x0020_Obligation_x0020_Da' />"+
							  		"<Value Type='Text'>"+vaFY+"</Value>"+
							  "</Eq>"+
							  "<Eq>"+
							  	"<FieldRef Name='Construction_x0020_Obligation_x0' />"+
							  		"<Value Type='Text'>"+vaFY+"</Value>"+
							  "</Eq>"+
							"</Or>"+
						"</Where>"+
		    			 "<OrderBy>"+
		    			 	"<FieldRef Name='Prioritization_x0020_Total' Ascending='True' />"+
		    			 "</OrderBy>"+
	    			 "</Query>"+
	    		"</View>";

Open in new window


here's the result when filtered by '2017' which is correct:
caml query filter 1
here's the result when filtered by '2018' which is wrong.  I have no idea why data is being returned.
caml query 2
here's the result when filtered by '2020' which is correct:
caml qry 3
Any idea why the inconsistent behavior?

Thanks!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Cloud Expert
Most Valuable Expert 2013
Top Expert 2014
Commented:
Query looks OK. Are you sure the vaFY variable is filled with a value when filtering on 2018?
IsaacSharePoint Client Side Developer

Author

Commented:
Yes it is
Jamie McAllisterCloud Expert
Most Valuable Expert 2013
Top Expert 2014

Commented:
OK, well I can't see the query being the issue. My only feeling looking at the screenshots and code was that if the variable didn't get filled and somehow matched N/A then you might see the behavior.

Can you output the variable value for display during running to be absolutely sure of the value?
IsaacSharePoint Client Side Developer

Author

Commented:
I don't think the variable is the problem.
vafy

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