cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

List View to display entries where either of two lookups in the filtered list match the current item

I have a Relationships list that has two lookups into another list. The Relationships list documents how any two items in List A relate to one another. I want to show a List View on the form for List A that will show all Relationship entries where the currently displayed item is either lookup 1 or lookup 2. I have been trying to build a CAML query to accomplish this, but have had no success.

 

CAML.png

 

The CAML query above produces the following error on the form in red text:

"Name cannot begin with the ' ' character, hexadecimal value 0xA0. Line 4, position 49."

 

Any help is greatly appreciated!

Labels: (2)
Tags (1)
0 Kudos
Reply
4 Replies
Workflow Hero

Re: List View to display entries where either of two lookups in the filtered list match the current item

Hi  Greg,

Sorry, I need to correct myself. This is not an issue with us.

The error which is reproduced,  is related to character formatting issue so pass the query like the sample I put for you here and delete all white spaces. You need to remove the <Where> tag as well. 

To test, please pass the following query to your filtering.  This should work and please let me know if you still see the issue.

<Eq><FieldRef Name="lookup"/><Value Type="Lookup">test04</Value></Eq>

0 Kudos
Accept as Solution Reply
Not applicable

Re: List View to display entries where either of two lookups in the filtered list match the current item

Thank you!

I've cleared out all the white space and that did resolve the error from the form. However, the following CAML query still does not give me the desired results:

<Or><Eq><FieldRef Name="Test_x0020_Item_x0020_1"/><Value Type="Lookup">ID</Value></Eq><Eq><FieldRef Name="Test_x0020_Item_x0020_2"/><Value Type="Lookup">ID</Value></Eq></Or>

I have used ID to filter a list view by lookup before by setting it up as follows:

  • Filter Listed items: By a specified value
  • Where field *: Test Item 1
  • Filtered by value: ID (provided by using Insert Reference and going to the Item Properties tab)
0 Kudos
Accept as Solution Reply
Workflow Hero

Re: List View to display entries where either of two lookups in the filtered list match the current item

What if you pass the value for ID? Do you get results which you expect? I suggest start with a simple query and then add complexity to it. So it will tell us where this query going to have issue

0 Kudos
Accept as Solution Reply
Not applicable

Re: List View to display entries where either of two lookups in the filtered list match the current item

Thank you again, Shahrzad. The CAML query worked after I changed it to use the item's Title rather than ID. I was thrown off because the "By a specified value" filter worked by ID.

 

To summarize all steps for the answer in a single post:

  • Remove the <WHERE> tag.
  • Remove all unnecessary white space, even within tags.
  • Make sure to filter by the correct value for the lookup.
0 Kudos
Accept as Solution Reply