Avatar of -Darvin-
-Darvin-Flag for United States of America asked on

Crystal Reports formlua to narrow scope current month + 2

My report shows open sales orders by month.  Currently it shows any sales orders in the system for any month no matter how far out it is.  Management is particularly interested in the value of open orders for the current month plus the next two months.  I haven't been able to narrow down this scope yet so that it can run automatically.  I know i could accomplish this with a parameter field but that isn't acceptable.  The report needs to dynamically changed based on current month.
if isnull({#January}) then '' else 'January = ' + CStr({#January},0) + 
if isnull({#February})then '' else ' | February = ' + CStr({#February},0) + 
if isnull({#March}) then '' else ' | March = ' + CStr({#March},0) + 
if isnull({#April}) then '' else ' | April = ' + CStr({#April},0) + 
if isnull({#May}) then '' else ' | May = ' + CStr({#May},0) + 
if isnull({#June}) then '' else ' | June = ' + CStr({#June},0) + 
if isnull({#July}) then '' else ' | July = ' + CStr({#July},0) + 
if isnull({#August}) then '' else ' | August = ' + CStr({#August},0) + 
if isnull({#September}) then '' else ' | September = ' + CStr({#September},0) + 
if isnull({#October}) then '' else ' | October = ' + CStr({#October},0) + 
if isnull({#November}) then '' else ' | November = ' + CStr({#November},0) + 
if isnull({#December}) then '' else ' | December = ' + CStr({#December},0)

Open in new window

Enterprise SoftwareCrystal Reports

Avatar of undefined
Last Comment
-Darvin-

8/22/2022 - Mon
dougvarga

Sample select statement

{mydatabase.myfield} in Date(DatePart("YYYY",CurrentDate),DatePart("m",CurrentDate),1) to DateAdd("m",2,Date(DatePart("YYYY",CurrentDate),DatePart("m",CurrentDate),1))
ASKER CERTIFIED SOLUTION
dougvarga

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER
-Darvin-

Thanks very much to both of you.  Both solutions work so I split the points.  Peter your solution worked as it is but only for two months (current and next month) I changed the +2 to +3 and it worked fine.  Both solutions are equally effective but I awarded dougvarga more because he was first and his worked as it was.  Hope that's fair.  Thanks again to both of you!
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23