Weird RunRev IDE Problem

Mark Wieder mwieder at ahsoftware.net
Thu Jan 17 13:03:26 EST 2008


Dave-

I've changed it now. I agree "it" is awful, but overwriting input
parameters is almost as bad. The problem here is that "convert" is a
command rather than a function, it would be *much* better to make it
a function and return the result.

Agreed, but you'd have to change the syntax. You've used it like a command:

   convert myFieldValue to long date and long time

if you wanted to use it as a function you'd have to say

   put convert(myFieldValue, long date, long time) into myFieldValue

The docs list convert as a command. If you really need to, there's nothing 
(theoretically) stopping you from making a function that does what you want, 
but IMO it would be better in the long run just to get used to using the 
convert command the way it's documented to work:

FUNCTION ConvertTheHardWay pValue, pDateFormat, pTimeFormat
    local tConvertedValue

    put pValue into tConvertedValue
    IF pTimeFormat is not empty THEN
        do "convert tConvertedValue to" &&  pDateFormat && "AND"  && 
pTimeFormat
    ELSE
        do "convert tConvertedValue t" &&  pDateFormat
    END IF
    return tConvertedValue
END ConvertTheHardWay

put ConvertTheHardWay(theFieldValue, "long date", "long time") into myValue

This doesn't save any work (there's actually more typing to do) and you have 
to remember the syntax each time you go to use it...
-- 

 Mark Wieder
 mwieder at ahsoftware.net






More information about the use-livecode mailing list