Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Moving Elements Within An Array

Status
Not open for further replies.

gtf

Programmer
Oct 1, 2002
16
CA
Hi All,

In the page footer of a report I want to show the top 3 percentages. I have initilized the array in the report header like:
WhilePrintingRecords;
Global NumberVar Array percent [0, 0, 0];
In the group footer for the sales rep I want to put the formula:
WhilePrintingRecords;
Global NumberVar Array percent;
If {@percent} >= percent [1]
then
perecnt [3] := percent [2]
percent [2] := percent [1]
percent [1] := {@percent};
Basically shuffle everything down one and put the highest percent in slot [1].
I get the error message: The remaining text does not appear to part of the formula and it sets the cursor at the first ":=".
Can anyone tell me how to move one array element to another.

Thanks.
 
I think it would be easier if you just added a subreport to your report footer which calculates the percent field per salesperson (sum({table.sales},{table.salesperson}) % sum({table.sales}), assuming you're grouping on salesperson. Then do a topN (N = 3) on the summary. You could discard the "others" and then suppress all other sections of the subreport so that only the top3 percentages and corresponding salesperson name appear.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top