cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with a single subreport value in an Excel exports

Former Member
0 Kudos

First let me summarize my two basic questions:

1. Can you make a formula EvaluateAfter(x) a sub report?

2. Can you get a sub report to run (process some shared variables) in a section that has been suppressed?

Now the lengthy details, I have a report I'm building that has my at my wits end. It's a sales summary report that hides the detail line and prints the group footer as the main results, which I'm going to want to export to excel after. Due to performance reasons I had to unlink a table from the Database Fields that contained a single value for 'City' that needs to be in the group footer and have used a sub report to pull the singular 'city' value with an inner join (note: Crystal is being run on top of some 3rd party software here so I can't directly edit the DB). The report runs fine, but then I try to export it to Excel. If the city subreport didn't connect it leaves a blank value in the City column and in the excel export this knocks everything to the right of alignment.

So I tried a work around, I created two shared variables a boolean 'found' and a string 'city'. If the sub report is run, 'found' is set to true and 'city' is assigned its value. Then in the main report I used a formula to print 'city' if 'found' else print "N/A", this will prevent the excel export from losing column alignment. But, from what I can tell there is no way to get a formula to EvaluateAfter(x) a sub report, so to get it to run first I have to split my group footer up and put the sub report above the rest. This creates my next problem, I use the "Underlay Following Sections" option so that the printed crystal report looks correct, but when exporting it to excel the blank section underlay screws up the rows creating junk merged cells that prevent sorting. I can prevent that by suppressing the blank section that just runs the sub report, but it seems when Crystal suppresses a section while it will run regular formula's it skips over  any sub reports?

And that's where I'm stuck. Any ideas or suggestions would be appreciated, thanks.

Accepted Solutions (1)

Accepted Solutions (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi Randy,

1) No!

2) No however, there is a workaround! Suppress all sections inside the Subreport. Next, go back to the Main report > right-click the Subreport > Format > Subreport tab > Check 'Suppress Blank Subreport' > Go to the Section Expert of the section that holds this subreport > Check 'Suppress Blank section'.

This will suppress the section from view and still evaluate all shared variables. The subreport however, would still need to be in a section above the section that displays the shared variable's results.

Please test and let us know if the export works as expected with this approach.

-Abhilash

abhilash_kumar
Active Contributor
0 Kudos

I tested this and it works great!

-Abhilash

Former Member
0 Kudos

Yes that worked, thanks!

I had actually tried most of those steps, but I had missed that format subreport had its own 'suppress if blank' option. It's kind of hidden at the back there.

Answers (0)