Hi, I have create a function
public static double CallAge(string _status, string _sDate, string _eDate, string _last_update, string _report_datetime, string _total_holiday, string _total_hour)
{
if (_status == "6" || _status == "5" || _status == "4")
{
double Dys = 0, SatDys = 0, SunDys = 0;
DateTime d1, d2, dateLastUpdate;
TimeSpan timesp;
d2 = Convert.ToDateTime(_eDate);
d1 = Convert.ToDateTime(_report_datetime);
dateLastUpdate = Convert.ToDateTime(_last_update);
if (d2 < dateLastUpdate)
{
timesp = (d2 - d1);
Dys = timesp.Seconds;
SatDys = findWeekCount(d1, d2, DayOfWeek.Saturday);
SunDys = findWeekCount(d1, d2, DayOfWeek.Sunday);
if (Dys > 0)
{
Dys = Dys - (checkHoliday(_total_holiday) + SatDys + SunDys) * 86400;
Dys = Dys - (timesp.Days - SatDys - SunDys - checkHoliday(_total_holiday) * Convert.ToDouble(_total_hour));
Math.Abs(Dys);
return Dys;
}
else
{
return 0;
}
}
else
{
d2 = Convert.ToDateTime(_last_update);
d1 = Convert.ToDateTime(_report_datetime);
timesp = (d2 - d1);
Dys = timesp.Seconds;
SatDys = findWeekCount(d1, d2, DayOfWeek.Saturday);
SunDys = findWeekCount(d1, d2, DayOfWeek.Sunday);
if (Dys > 0)
{
Dys = ((checkHoliday(_total_holiday) + SatDys + SunDys) * 86400) - Dys;
Dys = Dys - ((timesp.Days - SatDys - SunDys - checkHoliday(_total_holiday) * Convert.ToDouble(_total_hour)));
Math.Abs(Dys);
return Dys;
}
else
{
return 0;
}
}
}
else
{
return 0;
}
}
How to get field from store procedure?
I try like this on Expression Editor :
=TicketAge(Fields.STATUS,Parameters.sDate.Value,Parameters.eDate.Value,Fields.LAST_UPDATE,Fields.REPORT_DATETIME,Fields.TOTAL_HOLIDAY,Fields.TOTAL_HOUR)
But it display error : An error has occurred while processing TextBox 'textBox25': The expression contains undefined function call TicketAge().
public static double CallAge(string _status, string _sDate, string _eDate, string _last_update, string _report_datetime, string _total_holiday, string _total_hour)
{
if (_status == "6" || _status == "5" || _status == "4")
{
double Dys = 0, SatDys = 0, SunDys = 0;
DateTime d1, d2, dateLastUpdate;
TimeSpan timesp;
d2 = Convert.ToDateTime(_eDate);
d1 = Convert.ToDateTime(_report_datetime);
dateLastUpdate = Convert.ToDateTime(_last_update);
if (d2 < dateLastUpdate)
{
timesp = (d2 - d1);
Dys = timesp.Seconds;
SatDys = findWeekCount(d1, d2, DayOfWeek.Saturday);
SunDys = findWeekCount(d1, d2, DayOfWeek.Sunday);
if (Dys > 0)
{
Dys = Dys - (checkHoliday(_total_holiday) + SatDys + SunDys) * 86400;
Dys = Dys - (timesp.Days - SatDys - SunDys - checkHoliday(_total_holiday) * Convert.ToDouble(_total_hour));
Math.Abs(Dys);
return Dys;
}
else
{
return 0;
}
}
else
{
d2 = Convert.ToDateTime(_last_update);
d1 = Convert.ToDateTime(_report_datetime);
timesp = (d2 - d1);
Dys = timesp.Seconds;
SatDys = findWeekCount(d1, d2, DayOfWeek.Saturday);
SunDys = findWeekCount(d1, d2, DayOfWeek.Sunday);
if (Dys > 0)
{
Dys = ((checkHoliday(_total_holiday) + SatDys + SunDys) * 86400) - Dys;
Dys = Dys - ((timesp.Days - SatDys - SunDys - checkHoliday(_total_holiday) * Convert.ToDouble(_total_hour)));
Math.Abs(Dys);
return Dys;
}
else
{
return 0;
}
}
}
else
{
return 0;
}
}
How to get field from store procedure?
I try like this on Expression Editor :
=TicketAge(Fields.STATUS,Parameters.sDate.Value,Parameters.eDate.Value,Fields.LAST_UPDATE,Fields.REPORT_DATETIME,Fields.TOTAL_HOLIDAY,Fields.TOTAL_HOUR)
But it display error : An error has occurred while processing TextBox 'textBox25': The expression contains undefined function call TicketAge().