Solved

Previous Formula Check

Posted on 2013-06-28
3
244 Views
Last Modified: 2013-07-05
I'm trying to use the previous function to check to see if I have duplicate departments in my detail.

my formula is : if dept = previous(dept) then 1 else 0

I though that by using the previous formula, I would get whats listed in the expect result.
Can you guys help me get the expected result by either using the previous command or something else.

Thanks

This is what I currently have:

Dept      DupCheck       Expected Result
01000    1                     0
01000    1                     1
01200    1                     0
01200    1                     1
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
3 Comments
 

Author Comment

by:metalteck
ID: 39285827
I got the formula to work:
if next({dept.ACCT_UNIT}) <> previous({dept.ACCT_UNIT}) then 1 else 0

Problem I get now is that I can't use it to evaluate my running total.
I get the following error message:
Running Total cannot refer to a print time formula.

Does anyone have any suggestion as to how I can correct this?
0
 
LVL 101

Accepted Solution

by:
mlmcc earned 500 total points
ID: 39286131
What are you trying to total?

Try this

In the report header add a formula
WhilePrintingRecords;
Global numberVar DuplicateTotal;
DuplicateTotal := 0;
""

Change your formula
WhilePrintingRecords;
Global numberVar DuplicateTotal;

If Not OnFirstRecord AND {Dept} = Previous({Dept}) then
    DuplicateTotal :=DuplicateTotal + 1;
""

In the report footer to display the number of duplicates
WhilePrintingRecords;
Global numberVar DuplicateTotal;

mlmcc
0
 
LVL 35

Expert Comment

by:James0628
ID: 39286475
FWIW, your original formula looks OK (except that it should check OnFirstRecord, like in mlmcc's formula).  I don't see how that formula could give you 1 on the first 01200 line.

 OTOH, your second formula, with Next <> Previous doesn't really make sense, because it's not even looking at the current record.

 Anyway, like mlmcc said, what are you trying to total (in your running total)?

 If you just want to know if there are duplicates, or how many there are, you could use Count ({dept.ACCT_UNIT}) and DistinctCount ({dept.ACCT_UNIT}).

 If you're trying to total some fields and only want to add them once for each "duplicate" record, there are ways to handle that.  For example, if the records are sorted by {dept.ACCT_UNIT}, you could have a running total evaluate "On change of" {dept.ACCT_UNIT}, so it only adds to the total when that field changes.

 James
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

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…
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 we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

627 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