Forum Discussion
Paginated Report Time Column Error
- 1 year ago
The issue you're encountering with `start_time` exporting as ######### in Excel and showing values like 23:58:51 is likely due to a mismatch between the underlying data type and formatting in your Paginated Report and how Excel interprets negative or improperly parsed time values.
π Root Cause
- In Excel, time values are stored as fractions of a day since 12:00 AM. A negative value like -0.999201388888889 isn't a valid time and renders as ######## or shows an incorrect time like 23:58:51 if forced.
- This suggests that start_time in your dataset may contain negative durations or is being misinterpreted as a numeric value instead of a time value.
β Solution
To ensure proper export of time values from your Paginated Report to Excel:
- Ensure the source value is a valid DateTime or TimeSpan (not a calculated numeric value).
- In your Paginated Report (Report Builder or Visual Studio RDLC Designer):
- Select the start_time text box.
- Right-click β Text Box Properties β Number β Time β Set to hh:mm:ss tt.
- In the expression, confirm you're using something like:
=Format(Fields!start_time.Value, "HH:mm:ss")
Or, if it's a string:=TimeValue(Fields!start_time.Value)
- Check your dataset to ensure it returns the time in a proper SQL datetime or time format (not a float or numeric).
- Ensure your dataset field is not returning negative values or incorrect data types. Example for SQL Server:
SELECT CAST(start_time AS TIME) AS start_time FROM your_table
π§ͺ Test
Try previewing your report and exporting it to Excel after applying the above changes. Check if the time displays correctly.
π Related Resources
βοΈ If my message helped solve your issue, please mark it as Resolved!
π If it was helpful, consider giving it a Kudos!
The issue you're encountering with `start_time` exporting as ######### in Excel and showing values like 23:58:51 is likely due to a mismatch between the underlying data type and formatting in your Paginated Report and how Excel interprets negative or improperly parsed time values.
π Root Cause
- In Excel, time values are stored as fractions of a day since 12:00 AM. A negative value like -0.999201388888889 isn't a valid time and renders as ######## or shows an incorrect time like 23:58:51 if forced.
- This suggests that start_time in your dataset may contain negative durations or is being misinterpreted as a numeric value instead of a time value.
β Solution
To ensure proper export of time values from your Paginated Report to Excel:
- Ensure the source value is a valid DateTime or TimeSpan (not a calculated numeric value).
- In your Paginated Report (Report Builder or Visual Studio RDLC Designer):
- Select the start_time text box.
- Right-click β Text Box Properties β Number β Time β Set to hh:mm:ss tt.
- In the expression, confirm you're using something like:
=Format(Fields!start_time.Value, "HH:mm:ss")
Or, if it's a string:=TimeValue(Fields!start_time.Value)
- Check your dataset to ensure it returns the time in a proper SQL datetime or time format (not a float or numeric).
- Ensure your dataset field is not returning negative values or incorrect data types. Example for SQL Server:
SELECT CAST(start_time AS TIME) AS start_time FROM your_table
π§ͺ Test
Try previewing your report and exporting it to Excel after applying the above changes. Check if the time displays correctly.
π Related Resources
βοΈ If my message helped solve your issue, please mark it as Resolved! π If it was helpful, consider giving it a Kudos! |