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

Subreport - reimport problem

Status
Not open for further replies.

CFDude

Programmer
Nov 7, 2001
316
0
0
US
I have a report with a link to a subreport (on-demand) and I pass 4 parameters to the report. This works fine until I re-import the subreport. After re-importing, the subreport will show no data. I know that the parameters are being passed, since they show up in the header. The only fix is to delete the subreport and add it back in, resetting the links, etc. Of course, I'd prefer not to have to this everytime.

Is this a bug that anyone is aware of? Any quick fixes? (Other than removing it and adding it)?

Thanks!
Tim P.
 
Did you by chance create the subreport from scratch or copy an existing file?

The other day I noticed a bug.

I saved a subreport as a report and then created a new subreport from it.

The new subreport (that I made changes to), behind the scenes used the same record selection as the original subreport even when I changed the linking and other things.

I had to recreate the subreport and the links seemed to take that time.

alley
 
I have seen this also, and have not found any solution except to delete the subreport, import it again, and re-link it. It looks as if the "Reimport" function is buggy.
 
You should only reimport a linked subreport if you used the 'default' links that CR creates to the subreport. If you linked to your own parameters, or used something other than 'equal to' in the subreport, the reimport will redo the links to the defaults.

To see the changes made by the reimport, look at the selection formula of the subreport and the parameter list in the subreport. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Ken,
I don't quite follow you -- if I make changes to the report, then I have to reimport it for the main report to accept the new changes. Or am I missing something there? I am not sure what you mean by the default links. The only links there are the ones that I created.


To answer alleys question, Yes, I did import an existing report as a sub report. It seems the only way to fix it is to delete it and recreate it.

Thanks everyone. I'll chalk this up to yet another Crystal bug.

 
I recommend that you make the changes to the subreport within the main report, not to the original external report. You do this by double clicking on the subreport object to open its design tab.

If you look at the selection formula of the (re-imported) subreport you will see the changes made by the re-import process. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Thanks Ken. Unfortunately, that will not work as the sub report also has to work as a stand alone report. I should be able to just modify the external report and just re-import. Ideally, I question why you would have to reimport it at all. If it is a link to an on-demand report, it should just pick up the changes.

Anyway, you pointed me in the right direction -- my subreport and main reports all use stored procedures, so I don't use any record select formulas. (Crystal is way too slow for me to allow them to do it :) So the reimport was sticking a formula in there. The formula doesn't even make sense!

I pass 3 fields and an existing parameter to the subreport that are all used for parameters in the subreport's stored procedure. The record select put in a bogus criteria such as
({MYTABLE.PERSONS_NAME} = {?REPORTMONTHYEAR})

ReportMonthYear is a string that I pass to the procedure (no, not a date) and has no correlation to the Persons_Name field in the sub report. I don't even link to that field
Why Crystal is sticking a record select in there I don't know. I even tell it to NOT select data based on the field.

I tell you I spend more time working around the bugs and problems in Crystal that I do actually creating reports.

Thanks for your help.

Tim P.

 
Re-Importing shouldn't make changes, I agree. It should keep the links (if any) as they were in the subreport being replaced. But, the way they are designed, a subreport is not a reference to the original, it is a separate copy of the original stored in the container. That is why there is an option to reimport changes (or not). You can make all of your changes to both copies separately, or you can change the original and reimport (and fix it each time).

If, after reimport, you remove the selection formula that CR adds, and possibly any new parameters that it adds to the subreport, I think it will be fine. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top