CAML query on lookup calculated column

0

I have a problem running a CAML query. I get a 0x80131904 exception.

My input data are the following one:

MasterList contains the following columns:

  • Title (default one)
  • MyTextColumn (single line text column)
  • MyCalculatedColumn (calculated column defined with the following formula: =MyTextColumn&"_"&Title

SampleData are:

Title     MyTextColumn  MyCalculatedColumn
 
Peter     Paris         Paris_Peter  
Arnold    Paris         Paris_Arnold
Gabriel   Nice          Nice_Gabriel

SecondList contains the following columns:

  • Title (default one)
  • MasterItem (Lookup column targeting MasterList and field Title. I added MyTextColumn and MyCalculatedColumn to bind data of the MaterList into the SecondList).

SampledData are:

Title   MasterItem    MasterItem:MyTextColumn   MasterItem:MyCalculatedColumn
 
Item1   Arnold        Paris                     Paris_Arnold     
Item2   Arnold        Paris                     Paris_Arnold    
Item3   Gabriel       Nice                      Nice_Gabriel     
Item4   Peter         Paris                     Paris_Peter 
Item5   Gabriel       Nice                      Nice_Gabriel

Now I want to run CAML queries on SecondList:

This CAML query runs OK and returns 2 rows as expected:

<Query>
  <Where>
    <Contains>
      <FieldRef Name="MasterItem" />
      <Value Type="Lookup">Gabriel</Value>
    </Contains>
  </Where>
</Query>

This CAML query runs also OK and returns 3 rows as expected:

<Query>
  <Where>
    <Contains>
      <FieldRef Name="MasterItem_x003a_MyTextColumn" />
      <Value Type="Lookup">Paris</Value>
    </Contains>
  </Where>
</Query>

BUT...this CAML query fails with an exception...and I did not find any restriction in documentation

<Query>
  <Where>
    <Contains>
      <FieldRef Name="MasterItem_x003a_MyCalculatedCol" />
      <Value Type="Lookup">Paris</Value>
    </Contains>
  </Where>
</Query>

Can someone tell me how I should format my last query for letting work. Th XML are extracted from the SAmrtCAML app that I used to test CAML queries...

Regards.

caml
asked on Stack Overflow May 19, 2021 by DUCOS

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0