Solved

CQWP Fails to Match on Single Line of Text field

Posted on 2010-11-16
9
585 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
Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Note:  There are two main ways to deploy InfoPath forms:  Server-side and directly through the SharePoint site.  Deploying a server-side InfoPath form means the form is approved by the Administrator, thus allowing greater functionality in the form. …
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…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

688 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