Solved

CQWP Fails to Match on Single Line of Text field

Posted on 2010-11-16
9
550 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
 
LVL 31

Author Comment

by:Jamie McAllister MVP
ID: 34165386
This particular sandbox is 12.0.0.6421
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

I used to be SharePoint evangelist in our company, so my Outlook always full of questions about how to do this, or where I can find that. One day I found such an email with the following question: "how to attach 3-State workflow (one of the workflow…
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…
This video discusses moving either the default database or any database to a new volume.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now