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

Sequential numbering

Status
Not open for further replies.

l8kerfan

Technical User
Feb 15, 2006
12
US
I'm pretty new to setting up reports in crystal so this is a real basic question. Is there a way to add a formula to a text field so that is prints out "Item Number" followed by a space and a number which would be sequential? Also, is there a way to subtract two dates and have the input come out as number of days? Thanks in advance.
 
1ST Formula:

"Item Number " & totext(recordnumber,0,"")

This assumes the rows are in natural order.

Otherwise you'll need to use a variable:

whileprintingrecords;
numbervar MyCounter:=MyCounter+1;
"Item Number " & totext(MyNumber,0,"")

2nd Formula:

dateadd("d",{table.date1},{table.date2})

-k
 
One more question. How do I get it to loop to "Item Number " 1 after the first group of records? I have this as a formula in a text field in the details section. I tried putting it in a group section but the numbering was not coming out properly.
 
Insert a running total that counts any recurring (non-null) field, evaluate for each record, reset on change of group. Use this running total instead of recordnumber in the formula.

-LB
 
If you mean reset the counter at the start of a next group, add another formula into the group header of:

whileprintingrecords;
numbervar MyCounter:=0;

-k
 
Ok, I'm a little confused. I was using this formula
"Item Number " & totext(recordnumber,0,"")

Do I need to use the second formula for that counter reset suggestion to work? Or will it work with the formula above?
 
Ahhh, recordnumber won't work as easily as it doesn't reset.

Note LBass's post above, you can use that method as well.

Note that your first post made no reference to a group, please take the time to properly explain requirements the first time.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top