• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1543
  • Last Modified:

Object doesn't support this property or method

Hi All,

I am getting an error that says "Object doesn't support this property or method"

It points to this line return ary.filter(function(elem) {  

	    operation: "GetListItems",
		listName: "Projects",
		async: false,
		CAMLViewFields: "<ViewFields><FieldRef Name='SiteProjectedAmount' /></ViewFields>",
		CAMLQuery: cml,
		completefunc: function (xData, Status) {	
		$(xData.responseXML).find("z\\:row").each(function () {		
				var ProjectItem = new Object();
				ProjectItem["AmountProjected"] = checkForUndefined($(this).attr("ows_SiteProjectedAmount"));
				ProjectItem["ProjectNumber"] = $(this).attr("ows_ProjectNumber");
				/*var x = checkForUndefined($(this).attr("ows_SiteProjectedAmount"));
				annualCost += parseFloat(x);*/
var uniqBy = function(ary, key) {
    var seen = {};
    return ary.filter(function(elem) {
        var k = key(elem);
        return (seen[k] === 1) ? 0 : seen[k] = 1;

uniqs = uniqBy(AnnualizedDataArray, JSON.stringify);
values = uniqs.map(function(x) { for(var k in x) return x[k] });
annualCost = values.reduce(function(a, b) { return a + b });

Open in new window

It works in jsfiddle. http://jsfiddle.net/GTpgA/41/

Any ideas?

  • 3
1 Solution
RobOwner (Aidellio)Commented:
What javascript framework are you using?  in your fiddle you're using mootools but this topic is listed at jQuery.  jQuery has its own filter function that may interfere but I'm suspecting after a bit of testing (changing your fiddle to use jQuery then no framework and it's still working) that the actual error is elsewhere in your code.

I would output to the console (console.log() instead of alert, you'll see more) the contents of AnnualizedDataArray before the uniqBy function, for instance to see if the data is in the format you expect.
IsaacSharePoint Client Side DeveloperAuthor Commented:
What's the best way to see what's in an array?  This is all being done in SharePoint which is really a web page.
RobOwner (Aidellio)Commented:
If you use console.log() it will dump the contents of the stay to the console. You can get to the console vis the developer tools by pressing f12
RobOwner (Aidellio)Commented:
so in other words:

uniqs = uniqBy(AnnualizedDataArray, JSON.stringify);

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

7 new features that'll make your work life better

It’s our mission to create a product that solves the huge challenges you face at work every day. In case you missed it, here are 7 delightful things we've added recently to monday to make it even more awesome.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now