1

I'm writing a small js library to abstract away the annoyance and complexity of creating a CAML query.

In that regard, can you explain the significance of both FieldRef elements within a Join, when one must be necessarily implied by the other:

<Join Type='LEFT' ListAlias='customer'>
   <Eq>
     <FieldRef Name='CustomerName' RefType='Id'/>
     <FieldRef List='customer' Name='ID'/>
   </Eq>
</Join>

The documentation clearly states (emphasis mine):

The field in the primary list must be a Lookup type field and it must lookup to the field in the foreign list. For this reason, all joins mirror existing lookup relations between lists.

Q: Shouldn't just the field in the primary list suffice to deduce the second field? Or am I missing a use case?

===

For a broader context:

In the js library I'm trying to simplify the join query so it would look something like the following:

var query = SPHelper.query().from("Orders")
              .join({on: "CustomerName", as: "customer"})
              .select(["OrderId", "customer.Address as CustomerAddress"]);

to generate the above CAML Join query + <ProjectedFields> and <ViewFields>, and have as much information as possible deduced from metadata.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.