В моем проекте 3 списка
- ListeBatiment с 2 полями (I DListeBatiment , CodeBatiment)
- ListeEtage с 3 полями ( IDListeEtage , CodeEtage, IDListeBatiment)
- ListeLocal с 3 полями ( IDListeLocal , CodeLocal, IDListeEtage)
Связывание полей
- ListeBatiment и ListeEtage связываются в SHAREPOINT с помощью lookupField IDListeBatiment
- ListeEtage и ListeLocal связывают SHAREPOINT с помощью lookupField IDListeEtage
Code JAVASCRIPT Для извлечения CodeEtage и CodeLocal:
var my_caml_query=
"<View>"+
"<ViewFields>"+
"<FieldRef Name='CodeLocal' />"+
"<FieldRef Name='CodeEtage' />"+
"</ViewFields>"+
"<Joins>"+
"<Join Type='INNER' ListAlias='ListeEtage'>"+
"<Eq>"+
"<FieldRef Name='IDListeEtage' RefType='ID' />"+
"<FieldRef Name='ID' List='ListeEtage' />"+
"</Eq>"+
"</Join>"+
"</Joins>"+
"<ProjectedFields>"+
"<Field ShowField='CodeEtage' Type='Lookup' Name='CodeEtage' List='ListeEtage' />"+
"</ProjectedFields>"+
"</View>";
RecupCodeEtage('ListeEtage',my_caml_query);
function RecupCodeEtage(listName, CAML) {
var clientContext = SP.ClientContext.get_current();
var oList = clientContext.get_web().get_lists().getByTitle(listName);
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml(CAML);
this.collListItem = oList.getItems(camlQuery);
clientContext.load(collListItem);
clientContext.executeQueryAsync(Function.createDelegate(this, function(){SuccessRecupCodeEtage(collListItem);}), Function.createDelegate(this, this.onQueryFailed));
};
function SuccessRecupCodeEtage(){
// code here if ok
}
function onQueryFailed()
{
// ;...
}
Итак, я не знаю, как я должен обработать, чтобы получить CodeLocal, CodeEtage и codeBatiment.
Есть ли у кого-нибудь решение или идея?
спасибо