Hi, I have a crystal report that looks like the periodic table. When I click one of the "squares" it opens another crystal report with more details. This is working fine and has been for months. Now I have been asked to add an enhancement which will place a hyperlink in the second report that will open a document (.txt, .pdf, or.doc) which has been attached to that record from another page in our web app.
I created a hyperlink field on the report and in the formula editor for the supress property I typed the following:
if not isnull, ({CARS_REPORT_AGENT_SUPPORT_CALLS_DETAIL.ATTACHMENT_ID}) and {CARS_REPORT_AGENT_SUPPORT_CALLS_DETAIL.ATTACHMENT_ID} > 0 then
{?paramURL} + "GetAttachment.aspx?attachmentId=" + Cstr({CARS_REPORT_AGENT_SUPPORT_CALLS_DETAIL.ATTACHMENT_ID})
(Not all records have attachments)
Then in the GetAttachment file the following will open the file after getting a blob from the database using the attachment id (.NET C#):
Response.BinaryWrite((
byte[])dr["FILEATTACHMENT"]);
Response.AddHeader(
"Content-Disposition",
String.Format("attachment; filename={0}", fileName));
The attachment opens great. The problem is after I close it, both my reports go blank. I can select the report window and hit F5 and the report will refresh correctly, but obviously, I can't give it to the client like this.
Any suggestions are appreciated. Hope you are all having a good day.