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

formula to have it auto number

Status
Not open for further replies.

rwn

Technical User
Dec 14, 2002
420
0
0
US
I have a label report that will print for shipping products. Each label must have its own unique number assigned to it. So when the label prints it will show:
Part Number
QTY Shipped
ASN#
and a Unique Label Number on the label.

Is there a formula that will uniquely assign a number to each label that is printed?

Thanks for the assist!
 
There is a function in Crystal called RecordNumber that you can use to uniquely number each record. This may work for you.
 
Each label that is shipped can not ever have the same unique number assigned to it. I don't think that would work.
 

RecordNumber will create a different number for each record in your query so they won't be the same.

Another way is to create two formulas like as below.

add this formula to the page header:
Code:
whileprintingrecords;
numbervar uniqueid := 0;

add this to the detail section:
Code:
whileprintingrecords;
numbervar uniqueid := uniqueid + 1;

If you're saying that each time you run the query, you need the new set of records to have a different number than the set of records from the last time the query was run, I don't think this is possible unless you change the value of the uniqueid in the page header formula to the last number used from the last set of records. But then you will have to do this everytime you rerun the query.
 
I think if you used a combination of the special fields datadate, datatime, and recordnumber you would never get the same result, as in:

totext(datadate,"MMddyy")+totext(datatime,"hhmmss")+totext(recordnumber)

-LB
 
Thanks to both. lbass's thought would assure labels printed in April would not be the same in Dec or even the next year. My criteria from the customer to ship too, is that I'm only allowed 7 digit, can the totext(datadate,"MMddyy")+totext(datatime,"hhmmss")+totext(recordnumber) be truncated? Like totext(datadate,"yy")+totext(datatime,"hh")+totext(recordnumber)? Then how long is the recordnumber?
 
That wouldn't give you unique data though. How frequently is the report run? Is it scheduled?

-LB
 
You could use our Share Function library to save the current number in an external file. Then next time the report runs, retrieve the number, add one for each record/group you process and save it again at the end of the report.

The share UFL was designed to save data between reports but it can also work between runs of the same report.

Download a trial version from our web site.

Editor and Publisher of Crystal Clear
 
The report label could be run 4 times per day, for each work day of the week.
 
What about using the date as Julian and showing 8042532. So it shows the YMMDDMINUTES. Can this be done?
 
That already uses 7 digits and two records could have the same time if you only taken to the minute level, so you would need to add a recordnumber to that, which would take multiple digits as well. Maybe try Chelseatech's solution. Or consider whether you really need a number that is so unique it will not occur again. Maybe what you need is an identifier for the recipient instead.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top