Tuesday, December 08, 2009

"There was an error retrieving data to display in this Web Part." with CQWP

I'm back with a new error... I knew it wouldn't be long.

This one is tricky because the error: "There was an error retrieving data to display in this Web Part" doesn't really tell me much of anything.  I also went into the 12 HIVE/LOGS and found little success in there as well.  We have things output as Verbose, and running Sharepoint on 3 domains makes it tough to find what you need.

So I went back to google and searched a bit more and finally came across: http://blogs.msdn.com/ecm/archive/2006/10/25/configuring-and-customizing-the-content-query-web-part.aspx

I went through the comments and found a clue to what might be the problem: "Most likely the error is caused because the lookup column allows multi choices.  Multi choices is not supported by the Cross List Query [XLQ] which is the data source of the Content Query Web Part" - Adri

Thanks Adri, I saw this on another page as well but I really didn't know where to look with an excess of 1000 sites being in existence.  I also noted, this error was hit or miss.  I would get it on certain page, or when I was filtering/grouping on certain criteria.  Most notably, filtering by 'Assigned to = Current User'.

Then another comment on that page (actually it was preceding): "I have just found that by grouping the items by another lookup column on that content type, the Portfolio lookup is displayed. As soon as I take this grouping off I get the error message as above. How strange." - Sam

That pretty much solved it for me.  Obviously, group on the filtered item that is causing the issue. And.... BOOM it worked.  Also to note, if you're displaying that field, 'assigned to' in my case, then you won't have an issue and won't have to group on it.  This can be a problem in some SQL code too, which makes sense because Sharepoint [lists] is an abstraction of SQL (more or less right?).

This error was fairly hard to solve because you don't have much info to work with.  I'm hoping someone else who happens to be blessed with this error can stumble across my blog!

One thing to note: My case is a more rare case.  The most typical cause of this error is that your XSL or outputted HTML is malformed and needs some debugging.  I knew that this had been working perfectly at one point, so there was something else going on. Definitely check the XSL first, though.

1 comment:

Unknown said...

Thanks, you definitely saved me a lot of time.

Grouping by assigned to solved it for me.