Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: IF and Display Post Reply Post New Topic
Author Message
p0pcan
Newbie
Newbie


Joined: 06 Sep 2011
Online Status: Offline
Posts: 24
Quote p0pcan Replybullet Topic: IF and Display
     Posted: 06 Sep 2011 at 3:18am
I am new to crystal and I am having an issue.  I am trying to pull information on invoices including the amount of tax paid.  the tax rate and invoice info are in different tables and are linked correctly.  The issue that I am having is that the tax table shows all current and previous tax rates that we have ever setup (even if they are not active) and I need to only show the rate that was in use at the time of the invoice.  How can I get the proper tax rate to be pulled instead of all of them??
Example:  here are the tax rates from the tax table
rate         effective date       expiration date
8.925       1/1/2011             12/31/9999
7.875       1/1/2008             12/31/2010
7.95         7/5/2006             12/31/2007
8.025       1/1/1998             7/4/2006

so if I have an invoice date of anything before 2011 but after 2007 then pull the 7.875 rate, or anything from 2011 to pull the 8.925 rate ect...

Is there an if statement or something like that i can use like:
if {table.invoice-date} = 2010 then {table.tax-rate} = 7.875

There are different tax jurisdictions in this tax rate table so hard coding the info would not work, it has to be pulled from the table (i.e. the tax rate for 2009 in Ontario would be different from Alberta so hard coding 7.875 would be wrong for an invoice in Alberta)
Thanks
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 06 Sep 2011 at 11:23am
In the Select Expert, edit the formula and add something like the following:
 
and {invoice.Invoice_Date} between {tax.Effective_Date} and {tax.Expiration_Date}
 
This should get you only the tax record that was active on the date of the invoice.
 
-Dell
IP IP Logged
p0pcan
Newbie
Newbie


Joined: 06 Sep 2011
Online Status: Offline
Posts: 24
Quote p0pcan Replybullet Posted: 09 Sep 2011 at 6:18am
Awesome...that seemed to work for me...thanks for the quick reply...
I do have another question now...I am trying to add an If statement for a posting year so posting year is either all years or a selection of years from the user...the posting-year field is a number field so I made the parameter field a number as well...this is what i have:
(If {?PostingYear} <> 'All' Then
    {arinvhdr.posting-year} IN {?PostingYear}
Else
True
)
When I check the syntax I get "A string is required here" and has {?PostingYear} highlighted...how can I get this to work with numbers??  I am using the same syntax for customer name input and that works fine.
Like I said, I am new to crystal and programming in general...so I get confused pretty easily with this stuff

Thanks again

IP IP Logged
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