CQWP Fails to Match on Single Line of Text field

Posted on 2010-11-16
Last Modified: 2012-05-10
OK, this might be an easy one for somebody. I'm prototyping a site which has several custom columns defined. One of these let's call it 'CityX' is a single line of text field.

Using CQWP, I specify the name of the city and it never returns results.

Other people have obviously faced this issue, but no solution is posted:

How do I get my CQWP to match on a custom Single Line of Text field?

For info, I've specified operators like Not Equal, and results are returned. It's like the value is being translated somewhere. Also tried 'Contains' but no results are returned for that either.

btw I have been using a subclass of CQWP to change all these operators easily, but I'm convinced that isn't the problem, as I've tried classic CQWP too and it fails to match in just the same way.

As it happens I was able to work around the issue by substituting a lookup field on the values of my text field, and they work in CQWP fine. I'd like to nail this issue for future reference though. Can't believe I've never run into this before!
Question by:Jamie McAllister MVP
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4

Expert Comment

ID: 34165207

Are you using the out of the box City field or did you add a field to your list called City? SharePoint has a site column called city already.

In the CQWP only site columns are visible in the filters, so it looks like the column that your selecting in the filter is the out of the box column, while on the list you added a custom field called City.

When you go to the list settings and you click on City. Can you check the URL? In my case (I used the site column City) the URL ends with Field=WorkCity. If yours is different then you didn't use the standard field. The solutuon will be to add the exisitng site column to your list.
LVL 32

Author Comment

by:Jamie McAllister MVP
ID: 34165236
No I'm not using the OOTB City column. That's why I said I had created several custom columns and mine was called CityX (rather than City).

There is no clash between my column and the OOTB one.

I want to know why CQWP doesn't match the value of a custom Single line of text column regardless of what it's called.

I daresay you could observe this in your own environment. If you don't that'd be useful knowledge too.

Expert Comment

ID: 34165336
Iv'e just created a new site column and then added this to a list. Then in the content query web part I selected my list as the source and selected list type Custom list.

Selected my custom field, Is Equal To and typed the value as used by one of my list items. And the filter is working fine.

I'm assuming that this is the same as what you have done.

Which version (full build number) of SharePoint are you using?
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

LVL 32

Author Comment

by:Jamie McAllister MVP
ID: 34165386
This particular sandbox is

Expert Comment

ID: 34165492
That should be ok.

Can you export the web part and post the exported xml here?

LVL 32

Assisted Solution

by:Jamie McAllister MVP
Jamie McAllister MVP earned 0 total points
ID: 34165601
Might have it solved. Just playing around with it, it seems to return results if I set the list type to Custom List rather than document library. The Document Library has some custom columns added, which probably explains why it wants that setting. Maybe it wasn't an issue after all, and the  post on social.msdn fell foul of the same issue?

Accepted Solution

psv1973 earned 250 total points
ID: 34165646
That's great!

Getting the query right is important for making the CQWP work. Please close this question.
LVL 32

Author Closing Comment

by:Jamie McAllister MVP
ID: 34194977
Probably query related. Further investigation will tell.
LVL 32

Author Comment

by:Jamie McAllister MVP
ID: 34205702
OK, solved this, it wasn't the query it was the default caching behaviour. Since I'd subclassed the CQWP I was able to set property UseCache = False and this restored the sane behaviour I would have expected to see. I nailed this because it edit view it was behaving properly and cache is turned off in edit mode.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
My Sharepoint challenge 4 66
VBA in SharePoint 3 61
sharepoint list help 2 53
SharePoint 2013 Search not working 9 70
There is one common problem that all we SharePoint developers share: custom solution deployment. This topic can't be covered fully in this short article, so all I want to do in this one is to review it from a development-to-operations perspectiv…
Pimping Sharepoint 2007 without Server-Side Code Part 1 One of my biggest frustrations with Sharepoint 2007 in the corporate world is that while good-intentioned managers lock down the more interesting capabilities of Sharepoint programming in…
In a recent question ( here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question