1
假設我有2所列出:隊和員工。每隊有許多員工:更新ProjectedField與SharePoint JOIN使用JavaScript客戶端對象模型
Teams
ID
Name
Employees
ID
Name
TeamID (foreign key of Teams)
如果我創建的員工LEFT JOIN
隊,可能我再set_item
和update
在團隊中Name
領域的聯合查詢?
var ctx = SP.ClientContext.get_current();
var list = clientContext.get_web().get_lists().getByTitle('Employees');
var queryText =
"<View>" +
"<Query></Query>" +
"<ProjectedFields>" +
"<Field Name='TeamName' Type='Lookup' List='Team' ShowField='Name' />" +
"</ProjectedFields>" +
"<Joins>" +
"<Join Type='INNER' ListAlias='Team'>" +
"<Eq>" +
"<FieldRef Name='TeamID' RefType='Id'/>" +
"<FieldRef List='Team' Name='ID'/>" +
"</Eq>" +
"</Join>" +
"</Joins>" +
"<ViewFields>" +
"<FieldRef Name='TeamName'/>" +
"</ViewFields>" +
"</View>";
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml(queryText);
var listItemsCollection = list.getItems(camlQuery);
ctx.executeQueryAsync(onSuccess, onError);
,然後更新TeamName
領域:
var first = listItemsCollection.get_data()[0];
first.set_item("TeamName", "something");
first.update();
ctx.executeQueryAsync(onSuccess, onError);
,是否支持? (我目前還沒有嘗試這種方式)
如果不是,可以選擇什麼?