Solved

CQWP Fails to Match on Single Line of Text field

Posted on 2010-11-16
9
577 Views
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:
http://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/f02f61ad-cd1f-4d04-b1ea-1cc659b82036/

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!
0
Comment
Question by:Jamie McAllister MVP
  • 5
  • 4
9 Comments
 
LVL 6

Expert Comment

by:psv1973
ID: 34165207
Hi,

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.
0
 
LVL 31

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.
0
 
LVL 6

Expert Comment

by:psv1973
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?
0
Technology Partners: 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!

 
LVL 31

Author Comment

by:Jamie McAllister MVP
ID: 34165386
This particular sandbox is 12.0.0.6421
0
 
LVL 6

Expert Comment

by:psv1973
ID: 34165492
That should be ok.

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

0
 
LVL 31

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?
0
 
LVL 6

Accepted Solution

by:
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.
0
 
LVL 31

Author Closing Comment

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

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.
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

The Scenario: Let’s say you have a quote worksheet in Excel that you use to work up sales figures and such for your clients. You utilize SharePoint to manage and keep track of these documents. You would like values from your worksheet to populate Sh…
If you create your solutions on SharePoint sooner or later you will come upon a request to set  permissions of the item depending on some of the item's meta-data - the author, people assigned as approvers, divisions, categories etc. The most natu…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

762 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