Solved

if then statement for first record of a group <> last record of the previous group?

Posted on 2012-03-22
6
407 Views
Last Modified: 2012-03-22
How to create an if then statement for first record of a group <> last record of the previous group?  this refers to group #2
0
Comment
Question by:kgittinger
[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
  • 3
6 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 37753150
Do you have a group in the report?
If so there is no real need for this test.

Test should be

If (OnFirstRecord OR {YourField} <> Previous({YourField}) then
    Do something with the first record of the group


mlmcc
0
 

Author Comment

by:kgittinger
ID: 37753217
I have tried this
if not onFirstrecord and {Table.employee_number} <> previous({Table.employee_number}) then 1 else 0
 but if the employee_number is the same as the last employee_number of the previous group it returns a 0

I do not know how to call the group...

Please know, group 1 is employer, group 2 is class.  Employees can be in multiple classes

Thank you very much.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 37753561
You can't call the group as such.
You put the formula on the report and at that point you have the current record and the previous record.

WHat are you trying to accomplish with this?

mlmcc
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:kgittinger
ID: 37753600
I need a listing of employees (of which could be in the same plan/class for multiple  occurances), but I only want to count them once.  I cannot use distinct count because the cross-tab does not add distinct count of groups...

Here is my entire formla for counting employees

if onFirstrecord
then 1 else
if not onFirstrecord and {Table.employee_number} <> previous({Table.employee_number}) then 1 else 0

is there an first record of group(2) as opposed to OnFirstRecord?

Thank you.
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 37753642
YOu can use DISTINCTCOUNT as a summary of the employee field

If you have this as the data

employer    Class    employee    yourformula
emp1          class 1    joe                 1    
emp1           class1    tom                1
emp1           class2     joe                 1                           joe is not the previous
emp1           class3     joe                 0                           joe is the previous

Right click the employee field
Click INSERT --> SUMMARY
Change to DISTINCTCOUNT
Put it in the employer group footer

mlmcc
0
 

Author Closing Comment

by:kgittinger
ID: 37753701
Thanks a million!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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…
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 …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

738 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