Link to home
Start Free TrialLog in
Avatar of Jeff S
Jeff SFlag for United States of America

asked on

Open PDFs from Crystal Report

I have a Crystal Report and in it a File Path that links all of a patients records to scanned in PDFs. This will be used in a secure environment, so not a risk. What i need to have happen is when I click on the file path in the report, it opens the document. Is this possible, click on a file path and open the PDF associated to that file path address?
Avatar of Raghavendra Hullur
Raghavendra Hullur
Flag of India image

Hi,

Can you provide more details like how are you passing the details of the file location? Is it provided via hyperlink or retrieved as part of a database field?
Avatar of Jeff S

ASKER

The SQL underneath provides a file location on the network. I would like to click on the field name and it take me to the document. I do not want to embed it, just take me to the location.
I don't think you can use file path from database and open the respective file unless we retrieve an embedded file using hyperlink.
If the file content itself is saved into database using say BLOB, we can retrieve that content using an OLE object.

It seems like you are looking to include multiple pdf files of patients, so, even OLE option may not be feasible for you unless you have all the details in a single file.
Avatar of Jeff S

ASKER

The report lists multiple objects for the respected patient .... I would retrieve just one value at a time and would need it to act almost as a hyperlink to file location. Right now, I copy the address and paste it into a web url and it retrieves the value just fine. I simply need to remove the time consuming part on copying the address and pasting it. Ideally, clicking on the link and having it open the address would be nice
Avatar of James0628
James0628

What's in the field?  Is it just a path to a single file, like "C:\folder\file.pdf" ?  If so, it seems straightforward enough.

 Put that field on the report (or use some other field, or even an image), then go into the field format and:
 Select the Hyperlink tab.
 Select the "A File" Hyperlink type.
 Click the formula (X+2) button beside the file name box and enter the field name.

 That should do it.  Then when you click on that report field, it should open the file in that path using the default program on that system for that file type (eg. Adobe Reader).

 The only "complication" that I've run into in some testing just now is that if you have more than one link on the same page, after you click on one, you may need to click somewhere else in the report before clicking on another link to open a different file (if you don't click somewhere else first, the second file may not open).

 James
A solution I can think of is to have a database field (may be patient id of the patient or some unique number) and have pdf files with same name in your file location.
So, what we can do is, we can create a dynamic hyperlink to the file location and on click of database field (say patient ID), we can pass that field value as file name and retrieve the file.

For the example of the hyperlink content, you can check the attached .rpt file by navigating in the path -> format field -->Hyperlink tab and click on X+2 against File Name.

Hope this is a feasible one for you.
Hyperlink.rpt
Avatar of Jeff S

ASKER

Gentleman,

I have tried this and it does not seem to work for me. I have a field name labeled "File Path". It is exactly as you both describe - a file path to the scanned image(s). I right clicked on the field name and went to the Hyperlink tab. I choose "A File" and under the Hyperlink Information tab I selected the X-2 and picked the field. I have attached the report file if you can look to see where I am messing this up. Scanned-EMR-Documents.rpt
Don't put the field name in quotes.  You used "{Data.FilePath}" as the formula, which just gives you that literal string.  Try {Data.FilePath} (no quotes).

 James
It won't work with just the file name in quotes as you mentioned it under hyperlink.

You need to have full path of the folder in which the files exists and refer the format I have provided.

Or for your easy reference, the file path should be in the format "C:\Users\Admin\Downloads\"&toText({test2.fileNumber}, '#')&'.pdf'

Where "C:\Users\Admin\Downloads\" is my local file path and you need to replace it with your actual folder path where the files exists.

{test2.fileNumber} is my database field which contains the values with same name as file names, so you need to replace that with your database field name.

As I mentioned in previous reply, you need to have same values as in your file names to get this working.

Hope this is clear.
Avatar of Jeff S

ASKER

I removed the quotes and it does not seem to do anything. I try double clicking on it and nothing opens.
Avatar of Jeff S

ASKER

Raghavenndra,

There are dozens of users scanning in documents from various locations in the company. They are all not consistent unfortunately on how and where the documents are stored. The "File Path" name tells me exactly where the file is ... I just need it to open versus having to copy and paste the address in a web browser. I wish they had it uniform and in one set location; however, they do not.
Thanks for clarifying that Jeff.
I just checked based on James's suggestion and I could see that we can retrieve the files from different locations as long as we can refer the correct file names.

For the example, I placed 2 files in 2 different locations and stored file location path in database and I could retrieve the files from both locations based on the fileNumber I passed which had 1 and 2 as values.

Check the attached file and it simulates the details as you mentioned.
Hyperlink.rpt
Try just dropping the field onto the report.

What data is it showing?

mlmcc
Avatar of Jeff S

ASKER

mlmcc,

The field is on the report - it is the link address.

User generated image
Then you can use that file path database field itself under hyperlink as it contains full path along with file name.
Is this from the Crystal Designer you are trying to open the PDF or is this form an end user viewing?

mlmcc
Avatar of Jeff S

ASKER

mlmcc -

I think you hit it on the head. I am going through the Medical Practice Management software to view the report and it may be restricting this somehow? Its not being viewed via the Crystal Designer.
Try this

Open the report
Click on a field other than the hyperlink
Click the hyperlink field to see if it works
Didn't see your comment on the viewing software.

The above comment probably won't make any difference.

You have it setup correctly
Try using  CTRL-Click or SHIFT-Click

mlmcc
ASKER CERTIFIED SOLUTION
Avatar of James0628
James0628

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jeff S

ASKER

Thanks