Link to home
Start Free TrialLog in
Avatar of Isaac
IsaacFlag 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:
User generated image
here's the result when filtered by '2018' which is wrong.  I have no idea why data is being returned.
User generated image
here's the result when filtered by '2020' which is correct:
User generated image
Any idea why the inconsistent behavior?

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of Jamie McAllister
Jamie McAllister
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Isaac

ASKER

Yes it is
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?
Avatar of Isaac

ASKER

I don't think the variable is the problem.
User generated image