Convert T/F

J. Landman Gay jacque at hyperactivesw.com
Tue Apr 2 21:01:00 EST 2002


Scott Rossi wrote:
> 
> Can "true" and "false" be converted into their numeric equivalents (1/0)?

The perfect chance to post one of my favorite handlers. Wish I'd written it:

function whichOne var,fld1,fld2 
-- from a handler by Tony Root
-- Handles a case where you need to return one value if your key is
empty, another if not.

  return (item offset(char 1 of (var = empty),"tf") of quote & fld1
&","& fld2 & quote)
end whichOne

You can adapt it to almost anything:

function whichOne var -- pass true or false
  return (item offset(char 1 of (var="true"),"tf") of "1,0"
end whichOne
-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the metacard mailing list