Solved

Properly written Running Total Code in Crystal Reports

Posted on 2013-05-29
2
237 Views
Last Modified: 2013-06-14
I was wondering if there was a "cleaner" way for me to write this code.
IF {Command.ACCOUNT} IN [6005,6015,6018,6020,6025,6030,6040,6050,6070,6075,6090,
                           6100,6110,6120,6170,6180,6190,6200,6235,6250,6253,6260,
                           6273,6274,6275,6283,6285,6385,6400,6410,6420,6435,6450,
                           6460,6470,6490,6520,6530,6540,6550,6700] AND
({?Year}-1) = {Command.FISCAL_YEAR} and {FBDETAIL.FISCAL_YEAR} = 2012 THEN TRUE
ELSE
IF {Command.ACCOUNT} IN [6005,6015,6018,6020,6025,6030,6040,6050,6070,6075,6090,
                           6100,6110,6120,6170,6180,6190,6200,6235,6250,6253,6260,
                           6273,6274,6275,6283,6285,6385,6400,6410,6420,6435,6450,
                           6460,6470,6490,6520,6530,6540,6550,6700] AND
{?Year} = {Command.FISCAL_YEAR} and {FBDETAIL.FISCAL_YEAR} = 2013 then true else

IF {Command.ACCOUNT} IN [6005,6015,6018,6020,6025,6030,6040,6050,6070,6075,6090,
                           6100,6110,6120,6170,6180,6190,6200,6235,6250,6253,6260,
                           6273,6274,6275,6283,6285,6385,6400,6410,6420,6435,6450,
                           6460,6470,6490,6520,6530,6540,6550,6700] AND
{?Year} = {Command.FISCAL_YEAR} and {FBDETAIL.FISCAL_YEAR} = 0 then true ELSE false
0
Comment
Question by:metalteck
2 Comments
 
LVL 100

Accepted Solution

by:
mlmcc earned 250 total points
ID: 39206057
Is there more to this?

IF {Command.ACCOUNT} IN [6005,6015,6018,6020,6025,6030,6040,6050,6070,6075,6090,
                           6100,6110,6120,6170,6180,6190,6200,6235,6250,6253,6260,
                           6273,6274,6275,6283,6285,6385,6400,6410,6420,6435,6450,
                           6460,6470,6490,6520,6530,6540,6550,6700]  THEN
     IF ({?Year}-1) = {Command.FISCAL_YEAR} and {FBDETAIL.FISCAL_YEAR} = 2012)
          OR
          ({?Year} = {Command.FISCAL_YEAR} and {FBDETAIL.FISCAL_YEAR} = 2013) 
          OR
         ({?Year} = {Command.FISCAL_YEAR} and {FBDETAIL.FISCAL_YEAR} = 0)   then
           TRUE
    Else
          False
Else
     False

Open in new window


Another way would be

IF {Command.ACCOUNT} IN [6005,6015,6018,6020,6025,6030,6040,6050,6070,6075,6090,
                           6100,6110,6120,6170,6180,6190,6200,6235,6250,6253,6260,
                           6273,6274,6275,6283,6285,6385,6400,6410,6420,6435,6450,
                           6460,6470,6490,6520,6530,6540,6550,6700]  THEN
          ({?Year}-1) = {Command.FISCAL_YEAR} and {FBDETAIL.FISCAL_YEAR} = 2012)
          OR
          ({?Year} = {Command.FISCAL_YEAR} and {FBDETAIL.FISCAL_YEAR} = 2013) 
          OR
          ({?Year} = {Command.FISCAL_YEAR} and {FBDETAIL.FISCAL_YEAR} = 0)   
Else
     False

Open in new window


mlmcc
0
 
LVL 34

Assisted Solution

by:James0628
James0628 earned 250 total points
ID: 39207138
Here's another version.

 James

IF {Command.ACCOUNT} IN [6005,6015,6018,6020,6025,6030,6040,6050,6070,6075,6090,
                           6100,6110,6120,6170,6180,6190,6200,6235,6250,6253,6260,
                           6273,6274,6275,6283,6285,6385,6400,6410,6420,6435,6450,
                           6460,6470,6490,6520,6530,6540,6550,6700] AND
(
 (
  ({?Year}-1) = {Command.FISCAL_YEAR} and {FBDETAIL.FISCAL_YEAR} = 2012
 ) OR
 (
  {?Year} = {Command.FISCAL_YEAR} and {FBDETAIL.FISCAL_YEAR} = 2013
 ) OR
 (
  {?Year} = {Command.FISCAL_YEAR} and {FBDETAIL.FISCAL_YEAR} = 0
 )
) then true ELSE false 

Open in new window

0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

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. …
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

757 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

22 Experts available now in Live!

Get 1:1 Help Now