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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counter in reverse

Status
Not open for further replies.

ganjass

Technical User
Dec 30, 2003
154
GB
CR10

Hi All,

I'm using a counter to conditionaly sum records. The question that i have is the counter starts at the top and works its way down, where as it would be more adventageous for me to have counter countdown, ie in reverse. is this possible

ie. 12 instead of 1
11 2
10 3
etc etc

Thanks in advance
 
Your best bet would be to create one formula to intialize a variable using the count function.

This example assumes that you have no groups and counting down overall.
Code:
numberVar counter := count({table.field}) + 1;
counter;
Put this formula in the report header and suppress it.

Now, create a second formula for decrementing and displaying your counter.
Code:
numberVar counter := counter - 1;
counter;
Place this formula in the detail section.

If you need this in a grouped report than please advise us on your layout so we can tweak it a bit.

~Brian
 
How would a counter have anything to do with a sum?

Rather than stating how you're attempting to perform the sum, you might find that there's another way to accomplish this, so try posting example data and expected output.

Brian's solution makes sense, although if you don't have any groups, you might also use just one formula in the details:

abs(((count({table.field})+1)*-1) + recordnumber)

If you're using groups, then you may have to go with a couple of formulas, but you can try just one:

abs(((count({table.field},{table.group})+1)*-1) + recordnumber)

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top