boz@eleazar.dartmouth.edu (John Boswell) (10/26/88)
(munch, munch) Hi. My question is relatively simple. (I hope the answer is too...) I'm developing a purchase order database in hypercard. I've implemented most of what I need, with the exception of a script that will give a summary of money spent during any given month on any given account. I'm stumped here. I want to be able to look at a card, see if the account number on the card is the one to be reported, and then check to see if the date is within the required range. It is this last requirement that gives me trouble. Sample script: put "10/1/88" into startDate put "10/31/88" into endDate --following is done for each proper card: put bg fld "date" into orderDate -- following if is where the script fails: if startDate < orderDate < endDate then -- do something else -- do something (i.e. beep) -- all I ever get is the beep. Now, I *really* didn't expect this to work, as what is in the startDate, endDate and orderDate containers is a string, and not a number. However, I can't figure out how to convert more than a character to a number. Can anyone help me implement something like the "if" routine above? (It's getting close to the end of the month *smile*). Thanks, John Boswell Dept. of Chemistry Dartmouth College Hangover, Nude Hampster 03755 boz@eleazar.dartmouth.edu
obrien@rocky5.rockefeller.edu.rockefeller.edu (Tom O'Brien) (10/26/88)
In article <10580@dartvax.Dartmouth.EDU> boz@eleazar.dartmouth.edu (John Boswell) writes: [if statement that compares date strings like "10/24/88" with < and >] > > Now, I *really* didn't expect this to work, as what is in the >startDate, endDate and orderDate containers is a string, and not a >number. However, I can't figure out how to convert more than a >character to a number. Can anyone help me implement something like >the "if" routine above? (It's getting close to the end of the month >*smile*). > What you need is "convert", as in "convert myDate to seconds". If you do this to all of the dates in question, you can compare them easily with < and >, since they'll just be big integers (seconds since 1/1/1904, probably). Tom O'Brien Rockefeller University Computing Services obrien@rocky5.rockefeller.edu NYC
ns@cat.cmu.edu (Nicholas Spies) (10/26/88)
For date math, look up the command "convert" in the Help stack; basically, convert to seconds to make date comparisons... -- Nicholas Spies ns@cat.cmu.edu.arpa Center for Design of Educational Computing Carnegie Mellon University