Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > Crystal Reports
|
Crystal Reports General discussion about Crystal Reports. For discussions specific to the book Professional Crystal Reports for VS.NET, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Crystal Reports section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 6th, 2004, 06:31 AM
Registered User
 
Join Date: Oct 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default If x then y else z help please

I'm creating a label report. The spine labels need to print book copy numbers ONLY if there is more than one copy.

I'm using a formula like this:

if {tInventory.fCopyNumber} > "1" then
    call := call+chr(13)+"c. "+{tInventory.fCopyNumber}
    Else
     call

Where "call" prints a number contained in another field and "1" signifys the copy number. My problem is i can only get 2 scenarios to work. One where only copies after 1 print copy numbers e.g. c.2, c.3 etc... However when there is a copy 1 it will not print anything.

The other scenario i can create is where items with more than 1 copy print correctly e.g. c.1, c.2, c.3 etc BUT when there are items with only 1 copy it will still print the c.1.

Is there a way of making a formula which will NOT print any copy information if there is only 1 copy but WILL print "including" the first copy if there are 2 or 3 etc?

I guessed an if x then y else z formula would need to be used but have tried things like:

if maximum ({tInventory.fCopyNumber}) >= "2" then
    call := call+chr(13)+"c. "+{tInventory.fCopyNumber}
    Else
     call

  But i just get error "The remanining text does not appear to be a part of the formula"..

Any suggestions please? Sorry if my explanation is confusing.
 
Old October 6th, 2004, 10:44 AM
Registered User
 
Join Date: Jul 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

is this going to help,

if {tInventory.fCopyNumber} > "1" then
    call := call+chr(13)+"c. "+{tInventory.fCopyNumber}
else if {tInventory.fCopyNumber} > "2" then
    call := call+chr(13)+"c. "+{tInventory.fCopyNumber}
else if {tInventory.fCopyNumber} > "3" then
    call := call+chr(13)+"c. "+{tInventory.fCopyNumber}
else if {tInventory.fCopyNumber} > "4" then
    call := call+chr(13)+"c. "+{tInventory.fCopyNumber}
else "leave blank or nothing"

 
Old October 6th, 2004, 11:06 AM
Registered User
 
Join Date: Jul 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

**** correction,
it should be something like this,

if {Order_Details.ProductID} > "10000" and {Order_Details.ProductID} <= "10100" then
    call := call+chr(13)+"c. "+{Orders.ShipCountry}
else if {Order_Details.ProductID} > "10100" then and {Order_Details.ProductID} <= "10200"
    call := call+chr(13)+"c. "+{Orders.ShipCountry}
else if {Order_Details.ProductID} > "10200" then and {Order_Details.ProductID} <= "10300"
    call := call+chr(13)+"c. "+{Orders.ShipCountry}
else "leave blank or nothing"

 
Old October 7th, 2004, 05:26 AM
Registered User
 
Join Date: Oct 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the replys, i have wasted your time it seems. The problem actually lay in that there was nothing unique about a record with 1 copy and a record with 3.

So Crystal couldnt distinguish when a book had 1 copy and when it 3 so, it would either:

a)Completly supress C.1's (Which is partially correct since anything with one copy shouldn't show this) and print C.2, C.3 etc...

b)Leave all the C.1's in (Which is not a good solution since books with 1 copy would show C.1) and print C.2, C.3 etc..

Thanks for reply though, i needed to learn about this statement anyway and your reply has cleared a lot up for me.










Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.