Thanks to Paul, I think I figured it out:
READYQUECalcDLT1.Value := Int(READYQUEDispatchlatesttime.Value);
READYQUECalcDLT2.Value := ((READYQUEDispatchlatesttime.Value -
READYQUECalcDLT.AsString := READYQUECalcDLT1.AsString +':'+
Put a Mask for Short Time on the field and viola!
Though times ending in 00 display like so: "12:0" instead of "12:00".
But I'll figure that out.
> > Gentle Folk,
> > I'm writing an application that is intended to upgrade an old Paradox
> > for DOS PAL application. I'm trying to get Delphi to calculate a field
> > to display it in the proper format. The field is a number like:
> > 8.25
> > And represents the time 8:15
> > I've added the field in the fields editor, as a calculated field and
> > added this code to the OnCalc event:
> > Table1Field1.Value := Int(Table1Field1.Value) +':'+ (Table1Field1.Value
> ^ ^ ^ ^
> is this String? Float? This is integer this is string float?
> > - Int(Table1Field1.Value))*60;
> ^ ^
> integer integer
> You are relying on implicit typecasts:
> string := integer + string + ( float - integer ) * integer;
> In pascal you have to be explicit about these things.
> Look into asInteger, asFloat, asString, asTime, as well as Format, intToStr, etc.
> Is your data stored as floating point? or as a string, like '4.25'
> You must have it as a string if you are trying to change it from 4.25 to 4:15.
> I am sorry that I am away from my PC now, but if you search for these in
> the VCL help, you should find them (assuming 2.01 help files or the corrected
> VCL help file) Good luck!
> > And I get a incompatible type error. I've tried Trunc in place of Int
> > with limited success, but still have type problems.
> > Can someone shed some light on this for a newbie? What are types? Am I
> > trying to be too direct? (i.e. lazy?)
> > Thanks in advance
> > Chris
> Paul Schopf