I am in urgent need of assistance. I have a formula in Crystal that will convert a numeric field to a time field. The problem is if the numeric field is less than 1:00 AM I get an error message "String Length is Less than 0 or not an integer. The formula is below: Any help would be greatly appreciated:
Local StringVar strTime;
Local NumberVar numHr;
Local NumberVar numMin;
Local NumberVar numSec;
Local TimeVar tTime;
Local NumberVar numFldLen;
If Not(IsNull({AMAPPN00.AMLETI}))Then
(
// eliminate possible number formatting issues
strTime := Trim(Replace(Replace(Replace(ToText({AMAPPN00.AMLETI},0),":","",",","",".","");
// breakout time components - hour component can be 1 or 2 digits
numFldLen := Length(strTime);
numHr := ToNumber(Left(strTime, numFldLen -4));
numMin := ToNumber(Mid(strTime, numFldLen -3, 2));
numSec := ToNumber(Right(strTime, 2));
// convert to time data type
tTime := Time(numHr,numMin,numSec)
)
Else
tTime := Time(0,0,0);
tTime
Local StringVar strTime;
Local NumberVar numHr;
Local NumberVar numMin;
Local NumberVar numSec;
Local TimeVar tTime;
Local NumberVar numFldLen;
If Not(IsNull({AMAPPN00.AMLETI}))Then
(
// eliminate possible number formatting issues
strTime := Trim(Replace(Replace(Replace(ToText({AMAPPN00.AMLETI},0),":","",",","",".","");
// breakout time components - hour component can be 1 or 2 digits
numFldLen := Length(strTime);
numHr := ToNumber(Left(strTime, numFldLen -4));
numMin := ToNumber(Mid(strTime, numFldLen -3, 2));
numSec := ToNumber(Right(strTime, 2));
// convert to time data type
tTime := Time(numHr,numMin,numSec)
)
Else
tTime := Time(0,0,0);
tTime