baseConvert help

Sarah Reichelt sarahr at
Fri Jan 28 00:15:10 EST 2005

> I'm converting a hexadecimal number to decimal. the below code works 
> and placed it in my label called myNumber
>   put baseConvert(tmpVar,16,10) into field myNumber
> The problem is I now need to use myNumber to do some calculations with 
> and place it in a field called myAnswer

Hi Paul,

Try something like this:

put baseConvert(tmpVar,16,10) into tMyVariable
-- do other stuff with tMyVariable which now contains the decimal 
number e.g.
put tMyVariable * 2 into tMyDouble

-- now you have 2 variables which can be put anywhere you like
put tMyVariable into field "myNumber"
put tMyDouble into field "myAnswer"

I always put object names inside quotes as it allows for multi-word 
names and makes the code easier to read. I wasn't sure whether you had 
a variable called myNumber that contained either the name of a field or 
the number of a field, but by putting it into quotes, it is obviously 
the name of the field.

This may not be what you were trying to do, but just ask again if I've 
got it wrong.


More information about the Use-livecode mailing list