从列表中求和,按日期过滤 [英] Sum from list with filter by date

查看:69
本文介绍了从列表中求和,按日期过滤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好SharePoint专业人员!
$


我有两个列表。在第一个管理器中添加订单,在第二个中,我需要从第一个列表中获取总和,按日期排序(日期应该与列表2的日期匹配)。 *查看图片* | 列表2中的日期 - 唯一



我认为最好的方式:

1)获取当前项目来自list1的REST API日期(日期格式问题)从$ 1 $
2)获取所有来自List1的项目,日期过滤器为
3)将Zakaz值从过滤后的列表中循环到变量

4)按变量更新list2中的所需项目



但我坚持使用REST API请求。在1) - 无法获得当前项目日期作为变量

想想你是否可以帮助我 - 我能理解如何获得Zakaz值的访问权限

Hi SharePoint pros!

I have two lists. In first one managers add orders, and in the second, I need to get the sum from the first list, sorted by date (the date should match the date of list 2). * check picture*| dates in list 2 - unique

I think the best way to go :
1) get current item date by REST API (couse of Date format troubles) from list1
2) get all Items from List1 with date filter
3) sum Zakaz values from filtered list by loop to variable
4) update needed item in list2 by variable

But I stucked with REST API requests. at 1) - cant get current item date as variable
think if you could help me - I could understand how to get an access to Zakaz values also

可以你帮我解决了这个问题吗?

can you help me with this issue?


推荐答案

你好v.bas,



是否有任何特定原因需要单独的Sum列表。如果它仅用于显示目的,那么您可以通过在List1中创建View来实现它。应用Group By DateParent列并在Zakaz上设置Total并选择Sum。在视图中,Sum将显示按DateParent分组的Zakaz值的
总和。



就REST API而言,您可以使用jQuery调用REST API。



Hi v.bas,

Is there any specific reason why you need separate list for Sum. If it's only for display purpose then you can achive it by creating a View in List1. Apply Group By DateParent column and set Total on Zakaz and select Sum. And in the view Sum will display the sum of Zakaz values grouped by DateParent.

As far as REST API is concerned you can use jQuery to call the REST API.

var serviceUrl= _spPageContextInfo.webAbsoluteUrl+ "/_api/web/lists/GetByTitle('List1_parent')/items?


filter = DateParent eq'2011-06-05'&
filter=DateParent eq '2019-06-05'&


select = DateParent,Title,Zukaz" ;;
select=DateParent,Title,Zukaz";

jQuery.ajax({
url:serviceUrl,
type:" GET",
headers:{" Accept":" application / json; odata = verbose" ;},
成功:功能(数据){
console.log(data.d.results);       
您的处理HERE
},
错误:功能(错误){
console.log(错误);
}
});

jQuery.ajax({
url: serviceUrl,
type: "GET",
headers: { "Accept": "application/json; odata=verbose" },
success: function(data){
console.log(data.d.results);             
//Do your processing HERE
},
error: function(err){
console.log(err);
}
});




$
使用上面的代码,您可以获得data.d.results(json数组)中的所有匹配记录。现在你可以阅读记录并进行处理。



希望它能给你一个良好的开端。 



With above code you can get all the matching records in data.d.results (json array). Now you can read the record and do your processing.

Hopefully it'll give you a good start. 


这篇关于从列表中求和,按日期过滤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆