Hi,
I am using Telerik.Reporting.dll (version 5.1.11.928) and Telerik.ReportViewer.WinForms.dll (version 5.1.11.928) in Q2 Reporting 2011.
I have a column which calculates difference in minutes and I want to show them meaningful in my Telerik report.
Here is my column: sum(cast(datediff(second, IEC.CREATE_DATE, IEC.STATUS_DATE) as float) / 60) TotalSentMinutes
Here is some example values for this column:
TotalSentMinutes
----------------------
2,15
0
1,36666666666667
92,1166666666667
902,383333333333 ... etc.
So, I want to show these values meaningfully by using Formatting in Textbox's value field. I wrote a method to show them formatted.
private string FormatMinutes(string number2)
{
if (number2 == "0")
return "";
int number = int.Parse(number2);
string day = string.Empty;
string hour = string.Empty;
string minutes = string.Empty;
string formatted = string.Empty;
if (number >= 1440)
day = (number / 1440).ToString();
if (((number % 1440) / 60) > 0)
hour = ((number % 1440) / 60).ToString();
if ((number % 60) > 0)
minutes = (number % 60).ToString();
if (day != string.Empty)
formatted += day + " day, ";
if (hour != string.Empty)
formatted += hour + " hour, ";
if (minutes != string.Empty)
formatted += minutes + " minutes";
return formatted;
}
I called this method in Textbox's value field like this: = IIf(Fields.SentCount = 0, 0, FormatMinutes(Fields.TotalSentMinutes))
However, I am getting error while formatting. Is it a syntax problem? Method calling problem? or should I substr values to get rid of commas in double values? How can I solve this problem?
Any suggestions?
Best,
Cihad
I am using Telerik.Reporting.dll (version 5.1.11.928) and Telerik.ReportViewer.WinForms.dll (version 5.1.11.928) in Q2 Reporting 2011.
I have a column which calculates difference in minutes and I want to show them meaningful in my Telerik report.
Here is my column: sum(cast(datediff(second, IEC.CREATE_DATE, IEC.STATUS_DATE) as float) / 60) TotalSentMinutes
Here is some example values for this column:
TotalSentMinutes
----------------------
2,15
0
1,36666666666667
92,1166666666667
902,383333333333 ... etc.
So, I want to show these values meaningfully by using Formatting in Textbox's value field. I wrote a method to show them formatted.
private string FormatMinutes(string number2)
{
if (number2 == "0")
return "";
int number = int.Parse(number2);
string day = string.Empty;
string hour = string.Empty;
string minutes = string.Empty;
string formatted = string.Empty;
if (number >= 1440)
day = (number / 1440).ToString();
if (((number % 1440) / 60) > 0)
hour = ((number % 1440) / 60).ToString();
if ((number % 60) > 0)
minutes = (number % 60).ToString();
if (day != string.Empty)
formatted += day + " day, ";
if (hour != string.Empty)
formatted += hour + " hour, ";
if (minutes != string.Empty)
formatted += minutes + " minutes";
return formatted;
}
I called this method in Textbox's value field like this: = IIf(Fields.SentCount = 0, 0, FormatMinutes(Fields.TotalSentMinutes))
However, I am getting error while formatting. Is it a syntax problem? Method calling problem? or should I substr values to get rid of commas in double values? How can I solve this problem?
Any suggestions?
Best,
Cihad