Solved

Properly written Running Total Code in Crystal Reports

Posted on 2013-05-29
2
239 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

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

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…
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…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

895 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

12 Experts available now in Live!

Get 1:1 Help Now