.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

FullTextSqlQuery using Multi-Valued Lookup Field

Posted By:      Posted Date: October 15, 2010    Points: 0   Category :SharePoint
Hi There,

I have written a bespoke search webpart powered by the Enterprise Search FullTextSqlQuery object (MOSS 2007). Everything is working well apart from one slight hiccup:

Part of the requirement is to be able to filter the result set using the value of a metadata property on the list items. This property is of the  Multi-Valued Lookup type. A user would assign one or more lookup values to the item and then would expect it to be returned in the search results when one or more of these values matches the filter criteria.

I've looked all over Google and I can't find any examples of where a multi-valued lookup field has been used in the WHERE clause of a full text sql query. Could anyone point me in the right direction?

Thanks very much,


View Complete Post

More Related Resource Links

Mission Impossible? Use Javascript to Disable a Multi-Line Rich Text Field


Hey Community,

Here's a tough one that I have struggled with and so far have not been able to find an answer for - how do you use Javascript to disable a multi-line rich text field.  I have customized a SP Edit form by adding a CEWP.  In the CEWP I have added the Javascript below (only a partial code sample provided) to disable several fields in the form.  The code works fine for single line text fields but it does not work for multi-line rich text fields.  Any suggestions?

<script language="javascript">
//This runs the function when the form first loads

//This locks the fields the users should not modify
function lockFields()
  var theInputTFTitle = getTagFromIdentifierAndTitle("Input","TextField","Title");
  theInputTFTitle.readOnly = true;
  theInputTFTitle.style.color = 'gray';
  //alert(" Value: " + theInputTFTitle.value);//for testing

   var theInputDDLReplyStatus = getTagFromIdentifierAndTitle("select","DropDownChoice","Reply Status");
  theInputDDLReplyStatus.disabled = true;
  //alert(" Value: " + theInputDDLReplyStatus.value);//for testing

  var theInpu

DVWP connections with multi-select lookup columns

I have a question concerning the Data View Web Part using SharePoint Designer 2007.   I have two list (A and B). List A has a lookup column (called B-items) with multiple selections to items in List B(using the Title column from B).   I create a web part page and insert a data view of using List A. I create another data view with data from List B. Next, I make a Web Part Connection between the two data views with A passing B-items column as parameter to List B data view. I then create a filter on the List B data view with a comparison of List B’s Title column equal to the parameter of List A’s B-items value when a user selects an item from List A data view. The problem is nothing appears in List B’s data view.   When I try the reverse of the above scenario it works fine.     I understand that this is properly functionality, but is there a way to achieve my first scenario? If so, how can it be accomplished?   I have looked through the web for help and found the answer here http://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/749b7477-f37f-4724-94b3-b6ace770e73a seems to be what I’m looking for. However, I am unsure how to implement his code into the web part page.   I am a worse than a novice with xsl so if anyone gives an example I would greatly appreciate step by step on what code is needed a

multi-valued parameter

I need to do something like this: DECLARE @SalespersonCode SET  @SalespersonCode = '''smith'' + ',' + ''jones'''@SalespersonCode = '''SMITH'',''JONES'',''ADAMS''' SELECT * FROM Salesperson WHERE SalespersonCode in (@SalespersonCode) but I cannot get any results to return.  Is there a way to put multiple parameters in a single variable to use with in IN statement? John Schroeder* FROM Salesperson@Salesperson Varchar(100)

How do you update a Lookup Field from CAML by Name rather than ID

Hi, I have the following batch update in my code: xml += "<Method ID='" + currentID + "' Cmd='Update'>"; xml +=   "<Field Name='ID'>" + ID + "</Field>"; xml +=   "<Field Name='FileRef'>" + fileRef + "</Field>"; xml +=   "<Field Name='Title'>" + doc.NewFileName + "</Field>"; xml += "<Field Name='Keywords'>" + doc.Keywords + "</Field>"; xml +=   "<Field Name='Select_x0020_Type'>" + ((doc.TypeName == "General") ? 1 : 2) + "</Field>"; xml +=   "<Field Name='Population'>" + "Demography" + "</Field>"; xml += "</Method>"; The Population field is a lookup. It works if I put the ID of the ListItem in there, but not if I put the name - I need to put the name in. Can anyone help? Thanks. John.  

DataView WebPart with lookup and person field

Hi I want to insert a dataview webpart, using REST, referring to a list with look-up fields and people fields. The results I receive are the ID's instead of the values. How can I get back the corresponding values? TIA Sjokke

Issue with multi-valued crawled property

Hi, The problem is, we have a multi-valued crawled property (Managed Metadata type) which we are mapping to a managed property. The managed property has been created, setting MergeCrawledProperties to false.   On the page http://technet.microsoft.com/en-us/library/ff393811.aspx , it states that if MergeCrawledProperties is not set, only the first element is stored in the managed property. We are seeing this behaviour in our environment.   That is causing an issue with refinement results based on this managed property, because it is not including the second element as a result. For example, if we crawl the following content:   Doc1.doc           Property1;Property2 Doc2.doc           Property1;Property2 Doc3.doc           Property2   Refinement results look like this: Property 1           RefinementCount = 2 Property 2           RefinementCount = 1   Ideally we would like to see Property 2’s RefinementCount = 3 to accurately reflect our source data.   We also tried setting MergeCrawledProperties to true , however this merges results together.   For example, with our scenario above, refi

WSS Lists - Lookup field information missing in Excel 2010

Hi, I've got this xls workbook which contains a two-way synchronized SharePoint list. This WSS list contains columns which are related to other lists: for instance the list we're using is a list of assignments, where an assignment is related to an accounting period. Our server also has another list with all accounting periods. Both lists are related since the assignment list as an accounting period column of lookup type which uses the accounting period list as a source. In previous versions of Excel, the output is that the accounting period field is a combobox populated with all availalble accounting periods. Thanks to that, the user can easily link an assignment to an accounting period by selecting a value in this combobox and synchronizing. This works great with Excel 2003 and 2007, however in 2010 (same workbook, consuming the same lists) related information doesn't appear. The combobox is empty and as a consequence the user gets a data validation error since the value in the cell isn't among available values. Is there something special I should do to enable this feature in Excel 2010? Regards, Carl 

SharePoint Designer 2007 Workflow needs to initialize lookup field value and store it

This is for a governance tracking list. I have two tables: Roadmap and Roadmap Status In Roadmap, there are two fields of interest that are lookup fields to Roadmap Status:Title they are Status and OldStatus When an item is entered in Roadmap, I want to force the initial Status to "Submit" from Roadmap Status. I don't see any way in my workflow to to lookup that item in Roadmap Status and place the pointer (I'm assuming it is a GUID) into the field. The value is also stored in OldStatus to catch changes as I'm trying to force order of status in a few cases but not all. I'm doing it with a Lookup instead of Choice because the business tends to change the terminology they like and this way I don't change it in several places plus it allows them to change it in the list instead of someone changing the list field values. I've seen several places on the forum where people have a similar problem and Lambert Qin has given an answer but it never fits this scenario exactly. Do I have to go back to Choice columns? I only have Designer and would rather not have to learn another tool for a simple SharePoint implementation. Thanks for any help!

Lookup field issue after restore

After restoring a site collection in MOSS 2007, lookup fields cannot link up with the parent list. May I know if this problem fixed in MOSS 2010? Besides, the list item GUID in MOSS 2007 are changed after restoring. Does this case still appear in MOSS 2010? Thanks!

Lookup field with drop downs

Hi, I have created a lookup called projectname in a list called status. This projectname selects it's value from the project list. There are 2 fields on this list that are drop down list of values that I want to appear in the status list as lookups based on the projectname. However any special field types such as person or drop down list don't seem to appear, it looks like you can only show the related text fields? Is there anyway around this? Many Thanks, Michael  

Issue Adding a new Lookup Field to an existing List Instance

I have a code base that houses all of the column, content types, template, and list instance definitions. Am using the Update functionlaity a lot from version to version. Has been working well to this point. I just added two new columns (fields), one a Lookup and the other a Multi-Lookup. The fields are added fine on the update, columns look correct and the content type to which these were added also look fine. I can create a new List instance from the content type, and the new lookup columns are fine. The problem is this. Any existing list instances that were created from this same content type, now blow up when I try and access list items via the SP GUI. Something about a valid GUID, I dont't have the exect error anymore, but will repost it when I recreate the issue for the tenth time. I tried deleting the new lookup fields from this new list instance, thinking that I might be able to re-add them to fix the problem, but I get a new stack trace when I try and re-add them. Any hints on where I can start digging would be appreciated. I think I'll start with comparing the list instance schemas between an existing list and a newly created one.  

lookup field list instance



Got and problem with and lookupfield I create some list instances, list definitions, content types with a lookupfields and all works fine  the list resovels the good list source guid so I can selected te values but when I try to save I get;

<nativehr>0x80070057</nativehr><nativestack></nativestack>Invalid data has been used to update the list item. The field you are trying to update may be read only.

When I manualy create a new list instance from the list definition everything works fine.
I'm guessing that the create list instances in the feature is causing the problem?

What am I doing wrong?


update a lookup field from different site


class FeatureReceiver:SPFeatureReceiver


public override void FeatureActivated(SPFeatureReceiverProperties properties)


SPList _SPList = (SPList)properties.Feature.Web.Lists["DestinationList"];

_SPList.ParentWeb.AllowUnsafeUpdates = true;

 using (SPSite oSiteCollection = SPContext.Current.Site) // or give a destination site collection here...
                     using (SPWeb oWebsiteRoot = oSiteCollection.OpenWeb("/sites/Source1/Source11"))
                        SPList oList = oWebsiteRoot.Lists["SourceProjectList"];

Page layout - Custom Multi line field limits at 255 chars



Hi group,


I hope i use the correct terms since I have a DUTCH :-( Sharepoint version.


I created a new Site Content Type, called activity.

I added a new column (Add from new site column)

The type of this column is: Multiple lines of text.

(I choose this because single line of text can contain up to 255 chars)


In Microsoft Office Sharepoint Designer (MOSD) I created a new pagelayout (File => new => Sharepoint Content => pagelayout)

and inserted the field activity to the .aspx page.

<SharePointWebControls:NoteField FieldName="Comments" runat="server"></SharePointWebControls:NoteField>

Why is the fieldname Comments I expected Activity?


I then created a new page (in MOSS) based on the created pagelayout.


Works like a charm.

Problem: I cannot add more than 255 chars to the field activity although it is a multiline type.

Does anybody

# string with cross site lookup field value of List in datasheet view in moss 2007

I am getting appended # code value with cross site lookup field value of List in datasheet view, and also i am getting this value while export to Spreadsheet. How to remove this value.....

# string with cross site lookup field value of List in datasheet view in moss 2007


I am getting appended # code value with cross site lookup field value of List in datasheet view. I dont want that hash coded value, i need actual value. Please provide me the solution.



Rajanikanth Rayala

Queries using lookup field


Is it possible to write queries that use IDs instead of text values (Title) when comparing values of lookup fields?

For example: I want to get all items from a list with a Category set to "Category A" (which has an ID=1). Category is a lookup field in this case.
The query I would want to use would look like this:
"<Where><Eq><FieldRef Name='Category' /><Value Type='Text'>1</Value></Eq></Where>"
This of course doesn't return anything, because instead I need to use this:
"<Where><Eq><FieldRef Name='Category' /><Value Type='Text'>Category A</Value></Eq></Where>"

The question is - is there a way of building queries using IDs of lookup fields rather than the text values?

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend