Solved

If - Date Formula, then $

Posted on 2010-11-24
2
342 Views
Last Modified: 2012-05-10
I am trying to write a formula that says if the report date is between the 1st and the 7th
then $135,000,
else 0 and  surpress the field if 0

We are on Crystal reports XI and our database (E2) is access based
0
Comment
Question by:bmessmore
2 Comments
 
LVL 17

Accepted Solution

by:
pssandhu earned 500 total points
ID: 34208147
It helps if you can be more specific with your requirments. However, I am going to assume that by report date you mean a date field in your access database and in that access database the table name is "TableName" and the field is called "DateField". In this case do the following:

1. Create a new formula and name it Amount.

2. In the formula, type this:
    WhilePrintingRecords;
    If Day({TableName.Datefield}) IN [1,2,3,4,5,6,7] Then 135000
    Else 0

3. Save and Close. Place the formula in the section you need to print this value in.

4. Then right click on the section name (on the left in crystal report) and select section expert.

5. Then click on the button right in front of "Suppress" titled "X+1" and a window will open up.

6. In the window type:
    {@Amount} = 0

7. Close the windows and save the changes.

8. Done.

Hope that helps.
P.
0
 
LVL 34

Expert Comment

by:James0628
ID: 34210988
pssandhu's suggestion should work.  Here's a slightly different approach.

 If you don't need that value in numeric form (like for a summary), then you can just output the value as a string, or output an empty string if the day is not 1 - 7.  Then you don't have to suppress the field if the day is not 1 - 7.  Create a formula (call it whatever you like) that's something like:

if Day ({date field}) <= 7 then
  "$135,000"


 If you do need the numeric value, you could create a formula like pssandhu's, or like this:

if Day ({date field}) <= 7 then
  135000


 But to suppress it when it's 0, you can just go to the field format, click Customize on the Number tab and then check the "Suppress if Zero" box.  That's a bit easier, and more straightforward, than entering a suppression formula as pssandhu suggested.  His suggestion will work, but if it's a numeric field, you might as well use the built-in "suppress if zero" option.

 James
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Error when running Crystal Report in BI 2 52
Mask on Parameter CR2008 28 45
Crystal image Object type? 7 30
Selection between two dates and time range. 21 26
Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now