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

label printing

Status
Not open for further replies.

staceyn

Technical User
Nov 19, 2004
107
US
Hello,
I am using version 10 of crystal pro with an informix database.

We have created a report that generates labels through Crystal based on a purchase order in the informix database. There is a field in the PO_detail table, that determines the quantity of a particular item.
What we are trying to accomplish, if this is possible, is to have Crystal generate labels based on the quantities in this field.

So if the first item on the PO has a quantity of 5, we want to tell Crystal to print 5 copies of the label, if the second item on the PO has a quantity of 10, the Crystal should generate 10 copies of that particular label.

Is this possible to do in Crystal? If so, any ideas on how to make this happen?

Thanks in advance,

Stacey
 
Dear Stacey,

See Ido's faq:

faq149-3226

Regards,

ro

Rosemary Lieberman
rosemary-at-microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.

You will get answers more quickly if you read this before posting: faq149-3762
 
Thanks Ro I will give this a try.
 
I'm not sure if this is a feature that is available purely in Crystal, but I do know a nifty technique I picked up in a college course to solve that problem called record inflation. But this assumes you have access to the database to create a new table and query/view.

Instead of thinking of printing 5 copies of the label from the report, it would be easier to generate 5 duplicate records of the label from the database and have them in the report.

Create a new table in the database called "Numbers" and give that table a single field called "Number". In this new table, you should create a huge list of numbers starting at 1 and going up to what ever value you want (usually your maximum qty value would work best). Generating these can be accomplished easily using VBA or perhaps importing them from Excel.

Now create a new query using your PO_detail and Numbers table, but don't link anything. Select the fields from PO_detail that you want to view. Then, for your WHERE criteria, you want to select all records where "Numbers"."Number" <= "PO_detail"."Qty". Then simply save your query, and then in crystal use it as your data source. You'll find that each label will be duplicated to the number in the quantity field.

The basic idea behind what this accomplishes is to duplicate each record by however many records exist in the Numbers table. For example, lets say i put the numbers 1 to 100 in the Numbers table, then each record in my query will be duplicated 100 times and look something like this:

id qty number
1 5 1
1 5 2
1 5 3
...
1 5 100
2 27 1
2 27 2
2 27 2
...
2 27 100

but we don't want 100 duplicates for record 1, we just want 5, so you use the WHERE clause to select all records where the number is less than or equal to the quantity.

Wow, i really apologize for being long winded. I'm sure there is a better way to explain but I don't know how. haha. If something isn't very clear please let me know. I hope that helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top