>Exactly. Thanks for your reply.
So...
It may be "hard to do" if you think relationally - better think recursive!
Lets define a single iteration for retrieving the combinations that contain value from record 1.
They will be:
1;
1,2;
1,2,3;
1,2,3,4;
...
1,2,3,...,n
The number of these combinations is exactly n. Next step is to define the iteration for retrieving combinations that contain value of record 2 (except those containing value of record 1):
2;
2,3;
2,3,4;
2,3,4,5;
...
2,3,4,...,n
The number of these combinations is exactly (n-1)...
So if we summarize the above we will get the following algorith (draft program):
PROCEDURE CalculateSums
LPARAMETERS vnCurrentRecNo
Local lnaSums, lnIndex, lnCurRecNo
IF EMPTY(vnCurrentRecNo) Then
vnCurrentRecNo = 1
ENDIF
Dimension lnaSums(RECCOUNT()-vnCurrentRecNo+1)
lnIndex = 1
Locate RECORD (vnCurrentRecNo)
lnaSums(1)=Test.DataField
SCAN for recno()>vnCurrentRecNo
lnIndex = lnIndex+1
lnaSums(lnIndex) = lnaSums(lnIndex-1) + Test.DataField
ENDSCAN
IF vnCurrentRecNo<RECCOUNT() THEN
CalculateSums(vnCurrentRecNo+1)
ENDIF
ENDPROC
HTH
Zlatin Zlatev,
MCSD (VS6)Make solutions, not programs!