Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Properly written Running Total Code in Crystal Reports

Posted on 2013-05-29
2
Medium Priority
?
248 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
[X]
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
2 Comments
 
LVL 101

Accepted Solution

by:
mlmcc earned 1000 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 35

Assisted Solution

by:James0628
James0628 earned 1000 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

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. …
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…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

604 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