Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a contact list with a company lookup field and I need to retrieve those without any company associated

so I was thinking can I put it like this:

<Query>
      <OrderBy>
        <FieldRef Name="Title"></FieldRef>
      </OrderBy>
      <Where>
        <Eq>
          <FieldRef Name="Company" />
          <Value Type="Lookup"></Value> //or should I put null since it's a lookup field??
        </Eq>
      </Where>
    </Query>
share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

If you want items with no lookup value you could use:

<IsNull><FieldRef Name='Company'/></IsNull>
share|improve this answer
    
hey I just wanted to ask if we want to check this field lookup value in XSL format this wont work <xsl:when test="Company !=null"> <xsl:value-of select="Company" /> </xsl:when> do you have any idea? –  Glolita Mar 7 '13 at 8:25
    
Just if anyone esle is asking I found it and it's like that <xsl:when test="Company !=''"> <xsl:value-of select="Company" /> </xsl:when> –  Glolita Mar 7 '13 at 11:04
1  
That's nice. You should just ask a new question next time, so other people can find it :) –  Anders Aune Mar 8 '13 at 9:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.