Addition-Elementary Style

Eric Chatonet eric.chatonet at sosmartsoftware.com
Wed Jan 25 16:29:15 EST 2006


Hi Michael,

Assuming that your fields are, for instance , field number 1 to 8 and  
are ensured to be numbers:

local tTotal
-----
put 0 into tTotal
repeat with i = 1 to 8
   add fld i to tTotal
end repeat
put tTotal into fld "Total"

For a better security (but you have to care when creating the fields)  
you can use the IDS instead of the numbers:
For instance with 8 fields ID 1256 to 1293:

local tTotal
-----
put 0 into tTotal
repeat with i = 1 to 8
   add fld ID (1255 + i)  to tTotal
end repeat
put tTotal into fld "Total"

Le 25 janv. 06 à 22:03, Michael Mandaville a écrit :

> Revolution brothers and sisters,
> On the basis that the most stupid question is the one left unasked,  
> I throw
> myself on the pyre with this question:
>
> I have eight multiple text fields.  Numbers will go into these  
> fields.  I
> want all the numbers to add up and go into the Ninth field.
>
>
> Add field1+field2+field3 [etc.,} and put into field Total
>
> Add field Timeneed + Effort + People [etc.,] and put into field Total
>
>
> I have searched the documentation and tried a dozen syntaxes but  
> can't seem
> to get something as fundamental to work.

Best Regards from Paris,
Eric Chatonet
------------------------------------------------------------------------ 
----------------------
http://www.sosmartsoftware.com/    eric.chatonet at sosmartsoftware.com/





More information about the use-livecode mailing list