ANSWER: expr -> int in ACE select
Posted in 1994
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
I posted a question on how to convert an expression into an int in an ACE select so that the int could be used in before group of and after group of blocks. Thanks to everybody who sent email. John Shoemaker suggested a simple but kludgy solution, after some twiddling it worked. My specific problem was preparing an hourly histogram based on time of day (tod) stored as an int where (int) (tod / 10000) contains the hour. We have been doing this in 4GL, I wanted to prepare an ACE version. WHat I ended up with was: select year( mdy( 1,1, (tod / 10000 + 1900) ) ) - 1900 r_hour mdy() converts it's arguments into a DATE value, year() converts the year part of the DATE into an INTEGER. I added the + and - 1900 stuff since a year of 0 was invalid (presumably 1900 could be replaced by the lowest valid year, 1900 seemed safe.) Again, thanks to everyone who emailed... -Mike -- | o==== . : ... : : . |Mail Me Neat Stuff->POB 3703 Arlington VA 22203 --@-- . o o o ... O -O- o o : | mwiik@netcom.com | ... : : |----------------------------------------------- mEssAGE fRoM sPAcE ARt stUdiOs | Stop Global Whining