简体   繁体   English

SQL Server Reports Builder-显示当前星期的日期(帮助)

[英]SQL Server Reports Builder - showing dates of current week (help)

I am using SQL Server Report Builder to generate a weekly report to show the weekdays Monday - Friday and then the relevant dates. 我正在使用SQL Server Report Builder生成每周报告,以显示周一至周五的工作日,然后显示相关日期。

The report pulls the information from a calendar in SharePoint 2016. 该报告从SharePoint 2016中的日历中提取信息。

Instead I have created 5 columns with static weekdays and the week dates: 相反,我创建了具有静态工作日和星期几的5列:

The following generates the weekdays: 以下生成工作日:

=IIf(UCase(Format(Fields!Start_Time.Value, "dddd"))="MONDAY",FORMAT(Fields!Start_Time.Value, "h:mm tt ") & FORMAT(Fields!End_Time.Value, "- h:mmtt"),"")

The following generates the week dates: 以下生成星期几:

=FORMAT(Today.addDays(1-weekday(Today,FirstdayOfWeek.Monday)),"dd/MM/yyyy")

Screenshot of the SQL Report SQL报告的屏幕截图

Which means show the date/time of each weekDay otherwise leave blank. 这表示显示每个星期的日期/时间,否则留空。
The problem with this approach is that does show all the entries even those of last week ... 这种方法的问题是确实显示了所有条目,包括上周的条目...

The purpose is to show only for current week. 目的是仅显示当前星期。
Unfortunately, I am out of ideas and not sure what else can be done? 不幸的是,我没有主意,不确定还可以做什么?

UPDATE 更新

I have managed to find a way around this :) 我设法找到一种解决方法:)
The expression needed to be: 表达式需要为:

=IIf(FORMAT(Fields!Start_Time.Value,"dd/MM/yyyy")=FORMAT(Today.addDays(1-weekday(Today,FirstdayOfWeek.Monday)),"dd/MM/yyyy"),FORMAT(Fields!Start_Time.Value, "h:mmtt ") & FORMAT(Fields!End_Time.Value, "- h:mmtt"),"")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM