Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

CQWP Fails to Match on Single Line of Text field

Posted on 2010-11-16
9
Medium Priority
?
593 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
[X]
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
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 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.
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 32

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

Accepted Solution

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

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

Author Closing Comment

by:Jamie McAllister MVP
ID: 34194977
Probably query related. Further investigation will tell.
0
 
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.
0

Featured Post

Independent Software Vendors: 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

For SharePoint sites, particularly public-facing ones, there are times when adding JavaScript, Meta Tags, CSS Styles or other content to the page <head> section is more practical than modifying master pages.  For instance, you could add the jQuery l…
When using a search centre, I'm going to show you how to configure Sharepoint's search to only return results from the current site collection. Very useful when using Office 365 with multiple site collections.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

604 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