[AccessD] Math Problem

Gustav Brock gustav at cactus.dk
Tue Oct 14 13:52:34 CDT 2003


Hi Lonnie

So a maximum would be 10 rows?
Like Jim, out of curiosity, what is this accounting feature? Balancing
of payments or bank transactions?

/gustav


> Thank you Gustav,
 
> The number of rows may vary with each client. This will be an accounting feature. There will be a client number and that's how I will group. A client could have one record or ten records. I was
> looking for something efficient and something that I could load a couple of variables which would be the number of records and an array of the values.
 
> Thanks again.

> Gustav Brock <gustav at cactus.dk> wrote: 
> Hi Lonnie

> If you only have a few rows as shown I don't think you have any other
> possibility than trying the different combinations using some loops.

> You could, of course, start by ruling out some of the impossible
> combinations by adding all the negatives and all the positives; here
> it will return -5 and +18 which shows that 7 can be ruled out as it is
> larger than the absolute value of the sum of negatives. On the other
> hand, -2 and -3 must be included in any combination as the absolute
> value of the sum of these equals the smallest positive number, 5.

> If you have many rows you'll have to find some smarter routines as the
> number of combinations increase dramatically.

> /gustav


>> This is one for the math guys who code. I have a situation where I need to take a field in a group of records and see if any combination of the values in the field equal zero.

>> Example:

>> MyField
>> 5
>> -2
>> 7
>> -3
>> 6

>> This group of records would have a combination that equals zero (5, -2, -3). I hope someone has something. 



More information about the AccessD mailing list