primary item up with secondary items of close to equal value. So, for example, if you had primary and secondary items as follows:
Type Amount
P $1,000,000
P $750,000
S $50,000
S $465,000
P $20,000
S $650,000
S $400,000
S $300,000
Then, ideally, it may group them as follows:
P $1,000,000
S $650,000
S $400,000
P $750,000
S $465,000
S $300,000
P $20,000
S $50,000
Of course, it may not always group perfectly. In which case the extra primaries or secondaries would just be listed at the bottom. I thought I had a good start. It does a rough grouping of the items, but whenever I refresh the report, it groups it incorrectly. When I modify the formula (like add and delete a space -- just so I can save the formula again), then it groups correctly again until I refresh. Does that make sense? This is the formula I group on now:
The arrays are initialized in the report header. It adds the secondary amount to the total secondary amount until it's greater than the primary. So, if the total secondary amount is only $20,000 under the primary amount and the next secondary amount is $800,000, then it just adds it in. It would be nice to be able to keep the primary amount and the total secondary amount as close to equal as possible.
I'm not sure what else to explain at this point. I'll answer question when/if they come. I could REALLY use some help on this. I appreciate it.
Thanks,
Mark Knapp
Type Amount
P $1,000,000
P $750,000
S $50,000
S $465,000
P $20,000
S $650,000
S $400,000
S $300,000
Then, ideally, it may group them as follows:
P $1,000,000
S $650,000
S $400,000
P $750,000
S $465,000
S $300,000
P $20,000
S $50,000
Of course, it may not always group perfectly. In which case the extra primaries or secondaries would just be listed at the bottom. I thought I had a good start. It does a rough grouping of the items, but whenever I refresh the report, it groups it incorrectly. When I modify the formula (like add and delete a space -- just so I can save the formula again), then it groups correctly again until I refresh. Does that make sense? This is the formula I group on now:
Code:
Global NumberVar Array nPrimaryAmount;
Global NumberVar Array nSecondaryAmount;
Global NumberVar Array nClosedGroups;
Local NumberVar i := 1;
Local NumberVar j := 1;
Local NumberVar k := 1;
If {Logbook.Forecast Status} = "P" Then (
While nPrimaryAmount[i] <> 0 Do (
i := i + 1;
);
nPrimaryAmount[i] := {Logbook.Amount};
i;
) Else If {Logbook.Forecast Status} = "S" Then (
While nClosedGroups[k] <> 0 Do (
k := k + 1;
);
nSecondaryAmount[k] := nSecondaryAmount[k] + {Logbook.Amount};
If nSecondaryAmount[k] > nPrimaryAmount[k] And nPrimaryAmount[k] <> 0 Then
nClosedGroups[k] := 1;
k;
);
The arrays are initialized in the report header. It adds the secondary amount to the total secondary amount until it's greater than the primary. So, if the total secondary amount is only $20,000 under the primary amount and the next secondary amount is $800,000, then it just adds it in. It would be nice to be able to keep the primary amount and the total secondary amount as close to equal as possible.
I'm not sure what else to explain at this point. I'll answer question when/if they come. I could REALLY use some help on this. I appreciate it.
Thanks,
Mark Knapp