找文章 / 找答案
精选问答 更多内容

[数据处理] 日期过滤取未来一个月的数据

晨光熹微青铜一 显示全部楼层 发表于 2022-9-4 16:49:31 |阅读模式 打印 上一主题 下一主题
1
已解决
日期过滤,怎么才能做到,一进报表的时候,默认回填未来一个月的时间范围呢?

例如,回填今天9月4日,默认回填9月4日到10月4日。


论坛里看到一个脚本为
默认选中近一个月需要脚本写在页面的装载时运行
var nowdate = now()
var lastdate = dateAdd(nowdate,"month",-1)
var tmp1 = ""
var tmp2 = ""

tmp1 = "t" + year(lastdate) + "-" + (month(lastdate) - 1) + "-" + day(lastdate)
tmp2 = "t" + year(nowdate) + "-" + (month(nowdate) - 1) + "-" + day(nowdate)

日期过滤1.firstDates = [tmp1]
日期过滤1.secondDates = [tmp2]


这个脚本可以改为默认回填未来一个月的时间范围吗?

最佳答案

永洪蓝波湾 白银一 关注Ta

2022-09-04 16:49:32

var nowdate = now() var lastmonth = dateAdd(nowdate,"month",-1) var tmp1 = "" var tmp2 = "" tmp1 = "t" + year(lastmonth) + "-" + month(lastmonth) + "-" + day(lastmonth) tmp2 = "t" + year(nowdate) + "-" + month(nowdate) + "-" + day(nowdate) 日期过滤1.firstDates = [tmp1] 日期过滤1.secondDates = [tmp2]
查看完整内容
回复

使用道具 举报

精彩评论2

永洪蓝波湾白银一 显示全部楼层 发表于 2022-9-4 16:49:32
var nowdate = now()
var lastmonth = dateAdd(nowdate,"month",-1)
var tmp1 = ""
var tmp2 = ""
tmp1 = "t" + year(lastmonth) + "-" + month(lastmonth) + "-" + day(lastmonth)
tmp2 = "t" + year(nowdate) + "-" + month(nowdate) + "-" + day(nowdate)
日期过滤1.firstDates = [tmp1]
日期过滤1.secondDates = [tmp2]
回复

使用道具 举报

永洪蓝波湾白银一 显示全部楼层 发表于 2022-9-4 17:36:47
你好,绑定一个日期过滤组件,然后脚本写在报告上的加载时运行,试一下效果;然后脚本你看优化一下
回复

使用道具 举报

高级模式
您需要登录后才可以回帖 登录 | 免费注册

  • 官方微信

    欢迎关注永洪服务号!收费为0,价值无限

    扫码关注
  • 新浪微博

    让每位用户轻松挖掘数据价值!

    访问新浪微博
  • 智能客服
50W

会员等你来哦

Copyright   ©2012-2024  北京永洪商智科技有限公司  (京ICP备12050607) 京公网安备110110802011451号 |《永洪社区协议》
返回顶部