Help populating table with applescript
Hi
I'm posting here in the hope that someone can give me a helping hand with an applescript. I myself know very little about applescript. I can create something very basic but thats about it.
I have the following table
| Name | Value | Amount |
|---|---|---|
| Donald Duck | 4 | 5000 |
| Goofy | 10a | 7000 |
| George | 5 | 4000 |
| Steve | 4 | 6000 |
| Hank | 18 | 9000 |
| Sue-Ellen | 5 | 9050 |
| John | 18 | 11000 |
| Hector | 18 | 5500 |
I would like to create an applescript that runs through this table and populates another table, we can call it "Results", that would look something like this
| Value 4 | |
| Donald Duck | 5000 |
| Steve | 6000 |
| Value 5 | |
| George | 4000 |
| Sue-Ellen | 9050 |
A further complication is that this newly populated should only be populated if the following condition exists. The total sum of the newly created table (i.e the value column) should only be populated with posts from the original table as long as the sum of the newly created posts do not exceed the sum of a cell in a third table (we can call this the "sumtable").
To make it clearer. If the sum of the "sumtable" is 24 050 then the newly created table will only create the posts I have made above. These posts must be made using the following values and in the order the values appear. The complete list of values is 3a, 4, 4a, 5, 6, 7, 10, 10a, 12, 13, 18 . So the script would start looking for values in that order and whenever it reaches a total sum that is equal to the sum in "sumtable" it will use those values, and only those, and populate the new table creating the necessary rows needed.
It's possible that this is way to complicated to do. I have tried to make a formula in a table to do this but the problem is I ca never know how many rows are needed in advance.
Hoping for some help or tips, but understanding if this is asking too much considering the amoutn of effort needed.
Thanks
Mac mini, Mac OS X (10.5.8)