Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Counter needed for number of prints requested Post Reply Post New Topic
Author Message
gloworm
Groupie
Groupie


Joined: 10 Oct 2011
Online Status: Offline
Posts: 47
Quote gloworm Replybullet Topic: Counter needed for number of prints requested
    Posted: 02 Nov 2011 at 6:52am
I am using crystal that is integrated into an ERP system called MAS500.

I have a request to combine the part number and a unique field with 6 digits on the report that will count the number of prints requested.  These numbers must not duplicate.

For example, I have part number 666.  I want to print 10 of this report.  The numbers would be as follows: 666000001, 666000002, 666000003.........666000010.

How do I set this counter up?  I have looked at adding a Summary, but didn't see how I could make it relate to the number of prints.


Thanks in advance for your help.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 02 Nov 2011 at 8:15am
you need to 'multiply' your data.  This is akin to multiple label output.
 
so the best solution that I have seen is to utilize either a 'numbers' table to bring one in or create it on the fly.  While I haven't done it, you can bring in a table via an excel spreadsheet.  all that is in the table is 1,2,3,4,5,6...x
 
you can do this in a command object, and you can join the 'numbers' table to your main datatable with something along the lines of:
select * from mainTable cross join numbers where numbers.number < {?copies}
 
you can now use this new table to print your report, and you can format the number to look as you desire.
 
Hopefully I have given enough information, as I haven't done this myself (I use stored procs and would have just joined to the numbers table there), but hopefully this can point you in the right direction.
IP IP Logged
gloworm
Groupie
Groupie


Joined: 10 Oct 2011
Online Status: Offline
Posts: 47
Quote gloworm Replybullet Posted: 02 Nov 2011 at 8:39am
Thanks for the suggestion.  One other thing is that the whole printing process takes place outside Crystal, in the ERP system.

The client brings up the report module in their mobile system, and tell it from the handheld device, how many to print.  It is not like printing a report as usual where you hit print, tell it 10 copies and then Crystal prints them.

It is all controlled from the handheld device.

Basically I create the reports and they are assigned to a part number in the ERP system.  The report is then printed for the individual part numbers from the handheld device to a printer.  You tell the device how many copies, not actually Crystal.


Maybe this changes the above suggestion, IDK.

This is the first time I have used Crystal Reports where I am not printing from the App itself.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 02 Nov 2011 at 10:36am
no, this is still the same scenario as the suggestion. 
 
again, it like wanting to print as many labels as there items in inventory, sometimes it is 10 for one item and only 5 for another. 
 
It is different from those solutions in that the intial input (the number of copies) is coming from outside the data and not inside, but CR is still control of the printing, hence the parameter and the join to the 'numbers' table. It's all about duplicating the data, because CR will only print a row once in a report.  If you want it printed 10 times, you need to duplicate that exact row 10 times, then CR will print each row once, but it will appear to have been printed 10 times.
 
So what you are trying to do is to force a cartesian product in your data in a controlled manner.
 
HTH
 
ps the exact method might vary, but the general outline is what I was hoping to impart.  In this case it is to take a table from the report (hopefully the main/driving table) and multiply up the number of copies. Then all the details will multiply up as well, and you can use the copy value (from the number table) to create your unique id.
 
Where problems would arise is if this pairing always need to be unique.  So once 666000002 has been used it can never be used again, that would be much, much harder (I think)
IP IP Logged
gloworm
Groupie
Groupie


Joined: 10 Oct 2011
Online Status: Offline
Posts: 47
Quote gloworm Replybullet Posted: 05 Dec 2011 at 7:46am
I am still a little confused. 

I have added an excel file called PrintNumbers to the report.  All that is in the excel file are numbers 1-500 in column A of sheet 1.

In Database Expert, under Access/Excel (DAO), I have the file location on the server (C:\PrintNumbers.xls. 
Under that, I have Copies$.

I add Copies$ to the Selected Tables.

I try and create Command Object.
I tell it new object.  In window that comes up, I enter the following:

select * from ITEMS cross join COPIES where COPIES.COPIES < {?copies}
I create the parameter inside the object.  I have it created outside the object but it is not available to me when I am typing the command query.

I hit enter, put in a number for copies, and get a syntax error in the from clause.

Now where do I go?

Can someone please help me to figure this out?

I really have done work on trying to fix it but cannot make it happen.

I need help pretty bad.


Edited by gloworm - 05 Dec 2011 at 7:48am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 05 Dec 2011 at 10:10am
unfortunately, I don't think that I am of any help as I have never actually done this using a external file...just heard that it can be done.  So I don't know how to contruct the selection for the Excel file.
I don't know if I would use cross join, but it should be ok, since it makes a cartesian product.
 
we have a table of numbers that we can join against.
 
Sorry I can't be any more help.
IP IP Logged
gloworm
Groupie
Groupie


Joined: 10 Oct 2011
Online Status: Offline
Posts: 47
Quote gloworm Replybullet Posted: 05 Dec 2011 at 10:29am
its ok.  thanks for offering the suggestion.
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.