Avatar of Isaac
Isaac
Flag for United States of America asked on

SharePoint and CAML query help

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!
Microsoft SharePointJavaScript

Avatar of undefined
Last Comment
Isaac

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Jamie McAllister

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Isaac

ASKER
Yes it is
Jamie McAllister

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?
Isaac

ASKER
I don't think the variable is the problem.
vafy
Your help has saved me hundreds of hours of internet surfing.
fblack61