Solved

Properly written Running Total Code in Crystal Reports

Posted on 2013-05-29
2
240 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 AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Crystal Reports - group header 2 45
Crystal Reports Server, Unable to remove users 8 42
Sum of multiple formulas 6 18
Supress a section of a field 3 6
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. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
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.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

770 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