We help IT Professionals succeed at work.

SharePoint and CAML query help

Isaac
Isaac asked
on
245 Views
Last Modified: 2017-05-17
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

Cloud Expert
CERTIFIED EXPERT
Most Valuable Expert 2013
Top Expert 2014
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
IsaacSharePoint Client Side Developer

Author

Commented:
Yes it is
Jamie McAllisterCloud Expert
CERTIFIED 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