adding multiple fields

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
mincs2
Posts: 3
Joined: Wed Jul 21, 2010 3:02 pm

adding multiple fields

Post by mincs2 » Wed Jul 21, 2010 3:06 pm

I am trying to add 3 fields together and display the value in another field
I tried to use the "+" function and the "add" function but those only appear to work with 2 terms.

any help is greatly appreciated1

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10330
Joined: Wed May 06, 2009 2:28 pm

Re: adding multiple fields

Post by dunbarx » Wed Jul 21, 2010 3:21 pm

try this in a button:

on mouseUp
put fld "field1" + fld "field2" + fld "field3" into fld "field4"
end mouseUp

This assumes you have numbers in those three fields. If not, you need to validate the data:

on mouseUp
If fld "field1" is a number and fld "field2" is a number and fld "field3" is a number then put fld "field1" + fld "field2" + fld "field3" into fld "field4"
end mouseUp

See?

Did you mean you wanted the sum to appear in the results field just when numbers are entered into the other fields? If so, write back.

Craig Newman

mincs2
Posts: 3
Joined: Wed Jul 21, 2010 3:02 pm

Re: adding multiple fields

Post by mincs2 » Wed Jul 21, 2010 3:35 pm

thank you SO much!
There must have been something in my spacing or labeling.

Post Reply