Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Properly written Running Total Code in Crystal Reports

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

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  Formula to Command 4 88
Crystal Reports 9 and Subreports 3 78
Formatting number to Text Format DDDDDDDDCC 1 45
Exclude some records from totals 10 58
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. …
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

828 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