Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CR 7: Assigning Multiple actions in conditional statement 1

Status
Not open for further replies.

MsPepperMintUSA

Programmer
Mar 15, 2001
52
US
Hello All:
My eyes are tired and I have seacrhing through many threads for any possible solution. I have tried using the totaling FAQ, but was not successful. The totaling continues to count every new page for that record as 1. The built-in function PageNumber tracks the page number correctly, but I have not been successful using this function to create a flag identifying when the first page of the next Record would appear.

What I want to do is print the RecordID for the first page of the Record details and on subsequent pages of the same Record Details print the word Continue.

The equation below works perfectly for the first record, but then always prints "Continue" see equation 1.

I was trying to set the curRecord and PrvRecord and assign strContinue, but can not assign multiple values in the if-then-else conditional statement. see equation 2

Any suggestions/assistance in assigning the values to variable in the following equation would be greatly appreciated.
Equation 1
whileprintingrecords;
Shared StringVar strContinue;
Shared NumberVar curRecordID;
Shared NumberVar nxtRecordID;

if OnFirstRecord and PageNumber = 1 then
strContinue := 'Record:' + {record.rec_id}
Else
if {record.rec_id} = next({record.rec_id}) then
strContinue := 'Record:' +{record.rec_id}
Else
strContinue := 'Continued'


Equation 2
whileprintingrecords;
Shared StringVar strContinue;
Shared NumberVar curRecordID;
Shared NumberVar nxtRecordID;

if OnFirstRecord and PageNumber = 1 then
curRecordID := {record.rec_id};
nxtRecordID := next({record.rec_id});
strContinue := 'Lease:' + {record.rec_id};
Else
if curRecordID = nxtRecordID then
curRecordID :={record.rec_id};
nxtRecordID := next({record.rec_id});
strContinue := Record:' +{record.rec_id}
Else
strContinue := 'Continued'

Thanks In Advance
 
Hi MsPepperMint (cool handle...)
I think I can help you,
could you be more specific in what you want.


Peace
Jason



 
This might work:

1) Group by record ID
2) Set the Group Header to "repeat GH on each new page"

3) Create a formula field (see below) and place it in the GH:

If InRepeatedGroupHeader
then "Continued"
else "Record: " + {RedID} Ken Hamady
On-site custom Crystal Reports Training and Consulting.
Quick Reference Guide to using Crystal in VB.
 
Here's a sample of the results for my records

Record ID 1 (spans 7 pages)Page 1, 2, 3, 4, 5, 6, 7
Location Name
Location Address
SubReport 1
SubReport 2
Subreport 3
Subreport 4
Subreport 5

Record ID 2 (spans 3 pages) Page 8, 9, 10
Location Name
Location Address
Subreport 4
Subreport 5

Record ID 3 (spans 2 pages) Page 11, 12
Location Name
Location Address



What I need is logic which identifies page 1, 8,11 as the first page for the record and print Record ID # and pages (2-7, 9,12) as following pages and print Continued instead on Record ID #. There is no need to group in the main report all record are unqiue and will print(one-to one relationship). The only groupings occur in the subreport: many details for that one report.(many-to-one)
 
You may not NEED to group, but if you add the group anyway (it doesn't hurt to group on a unique field) it allows you to do what you want very simply. Ken Hamady
On-site custom Crystal Reports Training and Consulting.
Quick Reference Guide to using Crystal in VB.
 
Wanted to share my continue success with your suggestion. I also implemented a page numbering logic unique for each record in the report. For Record 2 Page 8,9,10 should read Page 1,2,3 etc
Equation 1 is suppressed. Equation 2 will return correct page number.

Two separate equation are created and both are placed in GH. Here's the code:

Equation 1
Shared NumberVar factorPageCount;
If InRepeatedGroupHeader
then
factorPageCount:=factorPageCount
Else
factorPageCount:= PageNumber - 1

Equation 2
Shared NumberVar RecPageCount;
If InRepeatedGroupHeader
then
RecPageCount:= PageNumber - {@PageFactor}
Else
RecPageCount:= 1

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top