Re: Length of smallint field
Posted in 2008
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
On Sep 10, 3:18 pm, monkeys paw <u...@example.net> wrote: > I have a table with a smallint field. A number is entered into > a 4gl form. I need it to be 0 padded, four digits wide. however, > the LENGTH() function doesn't work on smallint fields. So whether > user enters "600" or "0600", the length call below returns 0. > How can i get around this, i need it entered in military time > by the user, they must enter preceeding zero if time is less > that 1000, like "0900". > > let len = length(calRec.hearing_time) > message len Wow, an account that has been banned by Google for a TOS violation. Everett has it right. If you're using a field to enter time in a "military" fashion, use characters. Then use your after field statement to validate the entry. If a non numeric is entered then you can fix it. If they enter 6:00 you can update it to mean 06:00. If you need to do any calculations, you can strip leading 0's and or whitespace and then convert to a number and perform calculations.
Is there a function that will convert a smallint (600) to the char string "600", which i can then preceed with zeros? Ian Michael Gumby wrote: > On Sep 10, 3:18 pm, monkeys paw <u...@example.net> wrote: >> I have a table with a smallint field. A number is entered into >> a 4gl form. I need it to be 0 padded, four digits wide. however, >> the LENGTH() function doesn't work on smallint fields. So whether >> user enters "600" or "0600", the length call below returns 0. >> How can i get around this, i need it entered in military time >> by the user, they must enter preceeding zero if time is less >> that 1000, like "0900". >> >> let len = length(calRec.hearing_time) >> message len > > Wow, an account that has been banned by Google for a TOS violation. > > Everett has it right. If you're using a field to enter time in a > "military" fashion, use characters. > Then use your after field statement to validate the entry. If a non > numeric is entered then you can > fix it. If they enter 6:00 you can update it to mean 06:00. > If you need to do any calculations, you can strip leading 0's and or > whitespace and then convert to a number and perform calculations.