CAML to fields that are not keys

Dec 11, 2014 at 4:14 PM
Edited Dec 11, 2014 at 4:52 PM
Hello, i am glad with this library.

My answer is about CAML, this is the escenario.

Apps (Name: Text, Employee: Lookup)
Employee (Name, EmployeeCompanyID: Personal)

How can get the List of Apps asigned to an employe by the EmployeID, i try this but not work

CAMLQuery: "
<Eq><FieldRef Name='Employee' LookupId="true" />
<Value Type=' Lookup'>CompanyID</Value>
</Eq>"
Coordinator
Dec 11, 2014 at 4:31 PM
Your CAMLQuery isn't valid. You'll need to get more familiar with CAML in order to be successful with SPServices.
CAMLQuery: "<Query><Eq><FieldRef Name='Employee' LookupId='TRUE' /><Value Type='Lookup'>CompanyID</Value></Eq></Query"
You also had double quotes inside the single quotes, and a space before Lookup, both of which would have thrown errors in your code.

Finally, you're using CompanyID. Don't you mean to use Employee?

M.
Dec 11, 2014 at 4:44 PM
Hi Marc,

CompanyID means CompanyEmployeeID,

I need to filter the Apps that the current user is involved.

CAMLQuery: "<Query><Eq><FieldRef Name='Employee' LookupId='TRUE' /><Value Type='Lookup'>CompanyID</Value></Eq></Query>"

Sorry, but may be copy-paste insert some chars but before Lookup in <Value Type='Lookup'> there is no spaces.

Regards
Dec 11, 2014 at 4:53 PM
Could a field that is in the Lookup List by referenced like that ?

<Where>
<Eq>
<FieldRef Name='EmployeeCompanyID' LookupId='TRUE' />
<Value Type='Lookup'>Me</Value>
</Eq>
</Where>
Coordinator
Dec 11, 2014 at 5:00 PM
No, there is no "Me".

You should really dig into the CAML reference.

M.