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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal Reports 2008 - Main Report/Sub Report comparison

Status
Not open for further replies.

jgreenburg

Technical User
Oct 13, 2015
2
US
Hello,

I am trying to create a formula that will indicate if a record on main report is also on the sub report.


Main Report

All accounts (Every account that is on the database)


Subreport

List of accounts that meet certain criteria (Amounts past due 60 days)



Any input would be helpful!

Thanks,

Joe
 
Does the subreport run before the main report? If the subreport is run in the rpeort header, you can create a formula in the subreport that lists all the selected accounts, then make that a shared variable that the main report can access.
 
The sub report is in the page header of the main report. I wanted to suppress the list of the sub report and only have an indicate that there were accounts on main report list that had delinquent accounts. It seems that when you suppress a sub report the information does not pass to the main report any longer. I am fairly new at programming, so I feel like I am missing something.

What would a formula that lists the accounts look like? Would I need to create an array? Or would something like this work?

//List Mark Delinquent accounts

WhileReadingRecords
Shared StringVar IsDelinquent := ifnotnull{Account.Number};

If IsDelinquent is True
Then "Yes"
Else "No"

 
I would do it as a string.

In the Report Header:
@init
shared stringvar delin1 :="/"

In the Detail Section
@findDelinq
shared stringvar delinq;
if <your condition>
then delinq := delinq & {table.accountnumber} & "/ "
else delinq := delinq

in the report footer:
@passlist
shared stringvar delinq


On the main report I would split the report header into 2 sections.
The first section would include your subreport
The second section would have the formula
@getdel
shared stringvar delinq

Then in the body of the main report you can use
... {table.accountnumber} in {@getdel}

Very important - if the length of your account number varies then you need to include the delimiters in your search, like: ("/"+{table.accountnumber}+"/") in {@getdel}

This prevents false positives in cases like when you're searching for "12" and your string contains "4125"
By searching for "/12/" you avoid that problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top