Using formula in an OLE hyperlink to load file?
Printed From: Crystal Reports Book — Forum Name: Technical Questions
Posted By: RandV — 24 Aug 2017 at 10:29am
I'm using a Crystal Reports v10, it's a CR designer that's packaged into some ERP software, and I really need to be able to load a pdf file into it from a DB link. Searching on this topic seems really vague as no one seems to have a specific solution. Anyways, I notice that if I insert an existing pdf file int the report as an OLE object, in the Format Editor under the Hyperlink tab there is radio button option for Hyperlink type: A file. With this selected, you can browse to choose a file from disk, but there's also a formula option. Would it be possible to use this formula to load the pdf I need from a link stored in a DB field? I suppose if there are run time issues maybe I could also move the OLE object into a sub report and load it from a linked parameter. Either way, is it possible and how would I do this in the formula editor? Thanks
Posted By: kevlray — 25 Aug 2017 at 4:29am
Yes you can. I have done something similar. Just make sure the path is available where ever you run the report.
Posted By: RandV — 25 Aug 2017 at 11:05am
What about the how part? I have a DB field that will contain a string that has the file path, for example: C:\Documents and Settings\Randy\My Documents\example.pdf I feed the DB field into the formula directly in {}, and also tried surrounding it with double quotes, but either give no effect. Looking at the available functions I don't see any that would deal with loading a file. So I'm not sure what exactly I need in the formula to get it to load a file?
Posted By: kevlray — 28 Aug 2017 at 5:17am
You have to create a formula for the string. When I get a few minutes I will post an example.
Posted By: kevlray — 28 Aug 2017 at 5:33am
Here is the formula I used. In the database I have a value for the file name. I do not recall why I am removing the last two characters. '\Someserver\DATA\DATA\CRYS_REPS'+right({Command.Attachment},len({Command.Attachment})-2)
Posted By: RandV — 30 Aug 2017 at 4:57pm
Originally posted by kevlray
Here is the formula I used. In the database I have a value for the file name. I do not recall why I am removing the last two characters.
'\Someserver\DATA\DATA\CRYS_REPS'+right({Command.Attachment},len({Command.Attachment})-2)
Okay, so the difference of what you're doing there what I was initially doing is using a mapped or shared network location? So I setup the folder I'm using as a shared network location, and to start just tried hardcoding it: '\\myserver\data\form.pdf' But there's still no result. So I'm wondering, how did you initially insert the OLE object? I inserted it using a dummy PDF to test the report (as I needed it to print at the back with no headers/footers), then am trying to use the Hyperlink Text formula to change it. Also I notice that in the Formula Workshop, the object is being treated as a picture? I've been playing around with a few things to see if I missed anything, but I don't think so...
Posted By: kevlray — 31 Aug 2017 at 7:34am
I was just using a text box as a hyperlink to a file. And put my formula in the formula box to the right of the File Name: Unfortunately I do not have a way to upload a picture.
|