getting the total of fld "x" from every card of a stack

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
herbwords
Posts: 70
Joined: Sat Dec 01, 2007 2:59 am

getting the total of fld "x" from every card of a stack

Post by herbwords » Tue Aug 07, 2012 7:08 am

Hi,

fld "x" is on every cd of a stack after cd "firstCard" of the stack.

I'm trying to add the amounts of fld "x" from every cd in the stack and display the total in fld "y" on cd "firstCard"

any suggestions?

Thanks,

herbs

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: getting the total of fld "x" from every card of a stack

Post by jmburnod » Tue Aug 07, 2012 8:14 am

Hi Herbs,

I think this script do the job

Code: Select all

on AddValueOfFlds
   put 0 into tTotal
   repeat with i = 2 to the num of cds of this stack
      add fld "x" of cd i to tTotal
   end repeat
   put  tTotal into fld "y"
end AddValueOfFlds
Best regards

Jean-Marc
https://alternatic.ch

Post Reply