开发者

TimeSpan field types in Crystal Reports or Active Reports

开发者 https://www.devze.com 2023-04-04 11:26 出处:网络
In a report, I have to implement timespan fields (For example duration of a开发者_StackOverflow社区n activity). At the end of the report, a summary based on it should be included.

In a report, I have to implement timespan fields (For example duration of a开发者_StackOverflow社区n activity). At the end of the report, a summary based on it should be included. Neither Crystal Reports nor Active Reports support TimeSpan fields. I don't want to use any formula or other workarounds. Simply just show the TimeSpan fields (like 1:45, 45:23, 0:30) and show the summary at the end (like 109:20).

Any suggestion?


Try my ElapsedTime() function; use it with the summary field's Display String formula.


It is difficult to say for sure without knowing more information such as why you don't want to use formulas and whether this is a TimeSpan data type in SQL Server or it is stored in some other way in the database, or being calculating somehow (e.g. in application code), etc...

Without more information though, a formula is the right way to solve this in ActiveReports as well as Crystal Reports. Since you need a summary, in ActiveReports (where I have the most experience) I'd say the best way to do this is bring in the timespan value as a single numeric value as number of minutes. This will allow you to use the normal no-code ActiveReports summarization features as described here.

Then to format the number into the desired output text use a formula in the DataField property of the TextBox such as: =Math.Floor(Minutes/60) + ":" + (Minutes % 60). More information about using formulas in the DataField property is here and here.

Scott Willeke
GrapeCity
0

精彩评论

暂无评论...
验证码 换一张
取 消