[英]Sharepoint: Javascript - Getting List Data (including LOOKUP columns)
I have a list with a LOOKUP column to another list.我有一个带有 LOOKUP 列的列表到另一个列表。 The lookup column is called "Employee" and I want to GET the values from the "Employment Type" field.
查找列名为“Employee”,我想从“Employment Type”字段中获取值。 However I keep on getting a request error.
但是我不断收到请求错误。 What is wrong with my statement below.
我下面的陈述有什么问题。 Before, I was only looking for choice and $ columns.Everything worked fine until I inserted the
Employee/Employment_Type&$expand=Employee
part以前,我只是在寻找选项和 $ 列。在我插入
Employee/Employment_Type&$expand=Employee
部分之前一切正常
xhr.open('GET', _spPageContextInfo.webAbsoluteUrl + '/_api/web/lists/GetByTitle(\'' + listName +
'\')/items? $Funding$Funding_Type$Vacant&Direct&Employee/Employment_Type$select=ID,Employee/Employment_Type&$expand=Employee&$top=1000');
also, is my Employment_Type = results[i].Employee/Employment_Type
syntax correct below?另外,我的
Employment_Type = results[i].Employee/Employment_Type
下面的语法是否正确?
Note: I am only including a small part of the overall script注意:我只包括了整个脚本的一小部分
for (var i = 0; i < results.length; i++){
if (results[i].Direct == "DCSP" & results[i].Funding == "A-Base") {
dcsp_abaseSal += results[i].SalEnv3
Employment_Type = results[i].Employee/Employment_Type
TypeSal = results[i].SalEnv3
dcsp_vacant_days += results[i].Vacant_Days
dcsp_variance = dcsp_abase_cap - dcsp_abaseSal
}
}
rest api get look up column: rest api 获取查找列:
/_api/web/lists/getByTitle('test3')/items(1)?$select=Title,columnTitle/Title&$expand=columnTitle
You could add columns which you want to get after $select like columnTitle/sourceColumnTitle您可以在 $select 之后添加要获取的列,例如 columnTitle/sourceColumnTitle
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.