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!
LVL 5
IsaacSharePoint Client Side DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jamie McAllister MVPSharePoint ConsultantCommented:
Query looks OK. Are you sure the vaFY variable is filled with a value when filtering on 2018?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
IsaacSharePoint Client Side DeveloperAuthor Commented:
Yes it is
0
Jamie McAllister MVPSharePoint ConsultantCommented:
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?
0
IsaacSharePoint Client Side DeveloperAuthor Commented:
I don't think the variable is the problem.
vafy
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SharePoint

From novice to tech pro — start learning today.