Link to home
Start Free TrialLog in
Avatar of jhance
jhance

asked on

Record navigation in Crystal Reports

I'm woking on a report in VS 2003 using the include version of CR.  I have a situation where what appears in the current line of the detail depends on the next record.  So I have a formula like:

if Next(fld) = 0 then
"x"
Else
"y"

That's fine and working as expected.  But if the condition is TRUE I want to SKIP the next record and continue on with the record after that.

So (in phony code) what I want is:

if Next(fld) = 0 then
"x"
Next Record
Else
"y"

Is there a way to do a "next record" in CR?
Avatar of Mike McCracken
Mike McCracken

>>Is there a way to do a "next record" in CR?
Not in the sense that you want.

If you are simply trying to not show the record then use the formula for conditional suppression

On the Detail section left marign
Right Click
Click FORMAT SECTION
Click the formula button to the right of SUPPRESS
Formula
(Not NextIsNull(Fld)) and (Next(fld) = 0)

mlmcc
Avatar of jhance

ASKER

Well, perhaps I need a different approach...  Here are some more specifics on the situation, perhaps you can give some advice...

I'm attempting to create a membership directory off of a database that already exists.  People are organized into families and tied together with a family_id field.  So there is a member table like this (simplified):

member_id, family_id, first_name, last_name, addr, city, state, zip, phone, member_type

member_type is 1, 2, or 4 if the person is head of household, spouse, or dependent respectively.

I need to generate a report like:

Smith, John & Jane
(Johnny, Janey, Billy)
1234 Main St.
Chicago, IL 60609
312-555-1212

But if there is no "Jane" the top line should just be "Smith, John".  If there are no children, then that line should be left off.

So what I want to do in the code is:

if Next({member.member_type}) = 2 then
{member.first_name} + " & " + Next({member.first_name})
else
{member.first_name}

But in the case that this is true, I need to SKIP the spouse record.  Of course, I'm going to run into the same problem, only worse on the children since there can be a variable number of them.

Any suggestion on a better way to do this would be appreciated.
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
One other thing - Be sure to Suppress Blank Sections

mlmcc
Avatar of jhance

ASKER

That's really close to what I want.  One thing, however...

The groups get broken sometimes between the parent and the children at the end of a page even though I have the "keep together..." checkboxes set.  Any fix for that?
There is another keep together for groups

Right click the left margin of the Group Header
Click CHANGE GROUP
I believe there is a Keep Together check box there

mlmcc
Avatar of jhance

ASKER

No menu appears there.  Again, this is the CR designer in VS 2003, not the full-blown CR.  I'm not sure if that makes a difference on this point.
It does make a difference.

Check the other menus

I don't have .Net so I can't look for it

mlmcc
Avatar of jhance

ASKER

I found these checkboxes in the FORMAT SECTION/SECTION EXPERT dialog.  I also found checkboxes in the Report>Change Group Options.  All are set.
This is for earlier versions but it still may be useful

How Different 'Keep Together' Options Affect the Report
http://support.businessobjects.com/library/kbase/articles/c2010715.asp

mlmcc
Avatar of jhance

ASKER

mlmcc,

Thanks for your assistance on this.  The problem with keep together is apparently unresolvable.  The issue which has been addressed here before is that I'm using 2 columns in my report.  So while CR never broke the group apart at the end of a page, it happily does so at the end of column 1 and spills the rest into the top of column 2.

I guess I'll have to live with this...
Glad i could help

mlmcc