I have to sum the hours and minutes using expression in the rdlc report of microsoft report viewer, how can I do the sum of the values shown below?
=Split(CStr(Fields!Ore.Value), " ").GetValue(0) --> 03:30
=Split(CStr(Fields!Ore.Value), " ").GetValue(1) --> 02:00
=Split(CStr(Fields!Ore.Value), " ").GetValue(2) --> 08:00
=Split(CStr(Fields!Ore.Value), " ").GetValue(3) --> 04:30
Amira BedhiafiPosted Mar 5, 2025, 11:54 AM
You can use the
Splitfunction to extract the hours and minutes, then convert them to total minutes.For example, for the first value, and repeat this for each time value :
You can sum the total minutes using a custom code function in RDLC. Go to Report Properties > Code and add the following code to sum the minutes:
In your report, use the
AddMinutesfunction to add each time value:Finally, use the
GetTotalTimefunction to display the total time in "HH:mm " format.