Solved

Crystal Reports 2008 Formula Question

Posted on 2011-02-16
6
1,183 Views
Last Modified: 2012-05-11
I have a formula that deperates data by the previous 3 months. It works great except iit does not remove the rest of the data not needed. Can some one tell me what I need to add to it so it disregaursds the rest of the data I do not need.

if {RegisteredMembers.RegisteredTime} in dateserial(year(currentdate),month(currentdate),1) to currentdate then totext(dateserial(year(currentdate),month(currentdate),1),"MMMM yyyy")else
if {RegisteredMembers.RegisteredTime} in dateserial(year(currentdate),month(currentdate)-1,1) to dateserial(year(currentdate),month(currentdate),1)-1 then totext(dateserial(year(currentdate),month(currentdate)-1,1),"MMMM yyyy")else
if {RegisteredMembers.RegisteredTime} in dateserial(year(currentdate),month(currentdate)-2,1) to dateserial(year(currentdate),month(currentdate)-1,1)-1 then totext(dateserial(year(currentdate),month(currentdate)-2,1),"MMMM yyyy")
0
Comment
Question by:Nathan Webb
6 Comments
 
LVL 12

Expert Comment

by:JayConverse
ID: 34910799
You'll have to explain some more.  What does "it does not remove the rest of the data not needed" mean?  Give some examples.
0
 
LVL 42

Expert Comment

by:zephyr_hex
ID: 34910974
if you're using a SQL query to pull your data into the report, you could limit data to only those records that are within the last 3 months by using date criteria in the WHERE clause.

example

....
WHERE RegisteredMembers.RegisteredTime >= DATEADD(MONTH, DATEDIFF(MONTH, 0, CURRENT_TIMESTAMP) - 3, 0)
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 34911004
The formula you are using is simply to use in the report.  You aren't using it to filter the data so you need a filter as suggested above.

mlmcc
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 42

Accepted Solution

by:
zephyr_hex earned 250 total points
ID: 34911036
oops... also meant to say

if you are not using SQL Query / Command,
you could use a Report Selection formula that limits the records to only those in the last 3 months.

{RegisteredMembers.RegisteredTime} >= dateadd('m',-3,today())
0
 

Author Comment

by:Nathan Webb
ID: 34915767
So would I add the string to the formula I posted above?

if {RegisteredMembers.RegisteredTime} in dateserial(year(currentdate),month(currentdate),1) to currentdate then totext(dateserial(year(currentdate),month(currentdate),1),"MMMM yyyy")else
if {RegisteredMembers.RegisteredTime} in dateserial(year(currentdate),month(currentdate)-1,1) to dateserial(year(currentdate),month(currentdate),1)-1 then totext(dateserial(year(currentdate),month(currentdate)-1,1),"MMMM yyyy")else
if {RegisteredMembers.RegisteredTime} in dateserial(year(currentdate),month(currentdate)-2,1) to dateserial(year(currentdate),month(currentdate)-1,1)-1 then totext(dateserial(year(currentdate),month(currentdate)-2,1),"MMMM yyyy") else
if {RegisteredMembers.RegisteredTime} >= dateadd('m',-3,today())


Thansk
0
 
LVL 12

Assisted Solution

by:JayConverse
JayConverse earned 250 total points
ID: 34915793
No, you add it to the Record Selection formula.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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. …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
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…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

760 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

21 Experts available now in Live!

Get 1:1 Help Now