For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic Crystal Reports > January 2006 > Make Label Invisible on Second Copy









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Make Label Invisible on Second Copy
Carl Tribble

2006-01-17, 7:07 pm

Hi All,

I am using the version of Crystal Reports that came with my Visual Studio
2003. I am printing 2 copies of an invoice report. On the second copy I
want to make the company logo invisible. How can I accomplish this?

Thanks,
-Carl


Jay Taplin

2006-01-17, 7:07 pm

You could create a boolean parameter named SuppressLogo, and print
twice -
once with the param set to True, and one set to false. Then, in your
report, handle the suppression accordingly? May not be the most
efficient way to handle
it, but unless if you have two physically different pages in Crystal,
you're
probably stuck going this route...

Jay Taplin MCP

Carl Tribble

2006-01-17, 7:07 pm

How do you "handle the suppression" in the report? The is what I am trying
to figure out.

Thanks,
-Carl

"Jay Taplin" <jaytaplin@integraware.com> wrote in message
news:1137518954.915225.131110@f14g2000cwb.googlegroups.com...
> You could create a boolean parameter named SuppressLogo, and print
> twice -
> once with the param set to True, and one set to false. Then, in your
> report, handle the suppression accordingly? May not be the most
> efficient way to handle
> it, but unless if you have two physically different pages in Crystal,
> you're
> probably stuck going this route...
>
> Jay Taplin MCP
>



Jay Taplin

2006-01-17, 9:57 pm

Well, a couple of ways. One, if the only thing in the section that contains
the log IS the logo, then I'd suppress the section. Else, I'd suppress the
graphic (or text) that makes up your logo.

First, create a boolean Param named SuppressLogo. Next, right click either
the section or the logo/text, and click the little X-2 button to the right
of the graphic. Type in the name of the parameter ("{?SuppressLogo}")
(minus the parens and quotes, but including the curly brackets). That is
all you need to do!

Best of luck. If you need more help, post back.

Jay Taplin MCP


"Carl Tribble" <carl@tribblesoftware.com> wrote in message
news:%23ekjYG8GGHA.3936@TK2MSFTNGP12.phx.gbl...
> How do you "handle the suppression" in the report? The is what I am
> trying to figure out.
>
> Thanks,
> -Carl
>
> "Jay Taplin" <jaytaplin@integraware.com> wrote in message
> news:1137518954.915225.131110@f14g2000cwb.googlegroups.com...
>
>



Carl Tribble

2006-01-18, 7:07 pm

Thanks Jay,

I tried your suggestion and it gets me closer to what I am trying to do, but
still not quite. Let me explain in further detail what my problem is. My
client wants to print two copies of each invoice, one to give his customer
and one for his own internal use. At the top of the customer copy he wants
his logo and contact information. At the top of the internal copy he want
the phrase "OFFICE COPY" instead of the logo and contact information.
Because I could not find a way in Crystal Reports to control the visibility
of controls on the report dynamically based on which copy is printing, I
initially solved the problem by creating two separate reports, identical in
every respect except one had the logo and one had the office copy label
instead. In my application code, I simply printed the first report
immediately followed by printing the second report. This works fine except
for occassionally when he prints invoices in bulk (I have a routine that
automatically prints many invoices at once time) then my client says the
invoices sometime print out of order like this:

Invoice 1, Copy 1
Invoice 2, Copy 1
Invoice 1, Copy 2
....

Now, my application code uses an invoice object that contains a print
invoice function. This one function prints copy 1 and then copy 2. In
other words both copies are printed in the same procedure. In the code that
prints many invoices at once I am creating one invoice object and calling
its print function, then I create the next invoice object and call its print
function, and so on. I am not using threading and according to my client
this occurs when no other workstation is printing invoices so I do not know
how it is that the first copy of a different invoice gets printed before the
second copy of a prior invoice (it seems to me the print invoice procedure
must complete, printing both copies, before another invoice can be created),
but my client says this does indeed occur (but only intermittently). The
reason the client feels this is a big deal is that he puts paper in his
printer so that two different colors (yellow and pink) alternatively feed
in. He wants the customer copy on the yello paper and the office copy on
the pink paper. So when this problem occurs, it messes up his color paper
scheme.

So now I am back to where I tried in the first place to create a single
report, and from my code simply print two copies of it using
Report.PrintToPrinter.. and passing 2 for the number of copies. What I want
to do is have the report dynamically detect when it is printing copy 2 and
at that point change the visibility of the controls as needed. I see from
your suggestion below how to control properties like visibility dynamically
but if I use a parameter as you suggest, I am afraid I would still have the
same problem because I would still be printing the report two different
times from my application code, once with the parameter set to false and, as
you have stated, again with the parameter set to true. I did notice while I
was following your advice, that crystal does provide some useful properties
I could use dynamically - namely under the headings Print State and Document
Properties in the middle section of the Formula Editor dialog, but I could
not find any property that would allow me to detect which copy was currently
printing.

Well, that is a lot to read. If you made it this far and have any
suggestions at all, I would love to hear them.

Thanks again,
-Carl



"Jay Taplin" <jtaplin@integraware.com> wrote in message
news:94adna4p2smwJ1DenZ2dnUVZ_sudnZ2d@ad
elphia.com...
> Well, a couple of ways. One, if the only thing in the section that
> contains the log IS the logo, then I'd suppress the section. Else, I'd
> suppress the graphic (or text) that makes up your logo.
>
> First, create a boolean Param named SuppressLogo. Next, right click
> either the section or the logo/text, and click the little X-2 button to
> the right of the graphic. Type in the name of the parameter
> ("{?SuppressLogo}") (minus the parens and quotes, but including the curly
> brackets). That is all you need to do!
>
> Best of luck. If you need more help, post back.
>
> Jay Taplin MCP
>
>
> "Carl Tribble" <carl@tribblesoftware.com> wrote in message
> news:%23ekjYG8GGHA.3936@TK2MSFTNGP12.phx.gbl...
>
>



Jay Taplin

2006-01-18, 7:07 pm

Okay, I (finally) figured out a solution. It's a little convoluted,
but here goes:

1) Create a blank report, with no datasource.
2) Create a boolean parameter called "SuppressLogo"
3) Create a boolean parameter called "DontSuppressLogo"
4) Suppress all sections, except detail.
5) Create all necessary parameters for your real report.
6) Insert a section below detail (right-click on detail, and select
"Insert Section Below")
7) Go to "Insert...Subreport" and select the report you are printing.
8) Select your existing report
9) Click on the Link tab.
10) Copy each of your report parameters over to the listbox on the
right. For each one you copy, select the related field in the
subreport from the dropdown in the lower left (don't let Crystal create
them for you - it'll try).
11) Copy the DontSuppressLogo over to the right-hand list box.
12) When done, click OK and drop the subreport into detail section 1.
13) Do steps 7-12 again, except this time copy the SuppressLogo
parameter in step 11, and drop the subreport into detail section 2.
14) Expand the size of the detail sections and the subreports so they
fill a page (this will take a little playing around to get right).

When calling the new report, set the SuppressLogo param = True, and the
DontSuppressLogo to False.

That should do it. You'll have to tweak and modify accordingly, but
that is the general framework for what you'll need to do. It took me a
while to figure out, but I finally got it working.

Good luck!
Jay Taplin

Carl Tribble

2006-01-20, 7:11 pm

Thanks a lot for all your help Jay, I will give this a try and let you know
how it works.

-Carl

"Jay Taplin" <jaytaplin@integraware.com> wrote in message
news:1137622914.991784.64570@g49g2000cwa.googlegroups.com...
> Okay, I (finally) figured out a solution. It's a little convoluted,
> but here goes:
>
> 1) Create a blank report, with no datasource.
> 2) Create a boolean parameter called "SuppressLogo"
> 3) Create a boolean parameter called "DontSuppressLogo"
> 4) Suppress all sections, except detail.
> 5) Create all necessary parameters for your real report.
> 6) Insert a section below detail (right-click on detail, and select
> "Insert Section Below")
> 7) Go to "Insert...Subreport" and select the report you are printing.
> 8) Select your existing report
> 9) Click on the Link tab.
> 10) Copy each of your report parameters over to the listbox on the
> right. For each one you copy, select the related field in the
> subreport from the dropdown in the lower left (don't let Crystal create
> them for you - it'll try).
> 11) Copy the DontSuppressLogo over to the right-hand list box.
> 12) When done, click OK and drop the subreport into detail section 1.
> 13) Do steps 7-12 again, except this time copy the SuppressLogo
> parameter in step 11, and drop the subreport into detail section 2.
> 14) Expand the size of the detail sections and the subreports so they
> fill a page (this will take a little playing around to get right).
>
> When calling the new report, set the SuppressLogo param = True, and the
> DontSuppressLogo to False.
>
> That should do it. You'll have to tweak and modify accordingly, but
> that is the general framework for what you'll need to do. It took me a
> while to figure out, but I finally got it working.
>
> Good luck!
> Jay Taplin
>



Rob Diamant

2006-01-20, 7:11 pm

Carl,

Even though you have spent a lot of time already here is another possible
solution:

Add a table to your db called Copies with a field called Copy. This table
should have 2 records one for each copy.
Cross join this table into your report. This will "double" the number of
records returned.
Add a Group #1 based on Copy.
Format the logo to suppress when Copy = 2.

Rob

"Carl Tribble" <carl@tribblesoftware.com> wrote in message
news:OvjZ%23$3GGHA.2704@TK2MSFTNGP15.phx.gbl...
> Hi All,
>
> I am using the version of Crystal Reports that came with my Visual Studio
> 2003. I am printing 2 copies of an invoice report. On the second copy I
> want to make the company logo invisible. How can I accomplish this?
>
> Thanks,
> -Carl
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com