|
|||||||||
|
|
![]() |
|
|
|
![]() |
![]() |
|
Crystal Reports Tools: Improve Performance While Saving Time and Money |
|
Crystal Reports: Dynamic Images in a Crystal Report
By Bruce Ferguson, Chelsea Technologies One of the great new features in Crystal Report XI is dynamic images. You can insert an image into your report and then set the picture properties to select a different image at run time. This works well and it can locate an image on your local or network drive and can even retrieve an image from a web server and folder. The first thing to check is to make sure your new image actually exists. If the image can’t be found, the original image will remain. This can cause confusion if you expect each appearance of the image to be different. There are several solutions to this problem.
Another thing to watch out for if you want dynamic images in your reports is to make sure all the images are the same height and width. If they are not, they will be stretched or squashed to fit the original image dimensions. If your images vary in size, use the cViewIMAGE.ImageSize driver which will include the image height and width as fields in the record. You can then use this to select a different image aspect for more accurate presentation in your report.
|
|
cViewIMAGE is a COM data driver that can reference an image file in a field and return the embedded image to use in your report. This is a very handy utility--we all know a picture is worth a thousand words--why not add that power to your Crystal Reports? cViewIMAGE: Pricing | Buy Now
Delivery
Solution: Simple and inexpensive to install a UFL Another solution is to
Export to HTML, using our SMTP
UserFunction Library.
We have other User Function Libraries that send output to Outlook,
XML or a disk file. Some call this
“Report Bursting,” where your report engine uses a function library to
generate multiple output files. We now have an SMTP library that can embed images in an HTML message as the report is processing. This is a standard function in our SMTP library.
Security IssuesAt a client site, images in a report raised a set of security-related questions. The report we were asked to modify required a signature to be displayed on the page. The customer wanted the signature of the user running the report. Users were spread over several sites with multiple users at each site. With a shared PC, we couldn’t use the system user id to restrict access to the images. There were other complications to be resolved. Security considerations about individual signatures meant that we had to lock the image to individual users. Report delivery was via our cView report viewer. The solutions we discuss below could equally apply to Crystal Reports Server, Business Objects Enterprise or any other 3rd party report delivery. The key issue is that the users did not have access to the Crystal Reports Designer, and were using a delivery method that gave them the report to view. Authentication Issues Who is running the report? It was vital to have a secure way to do this. Because several users shared access and user id, it was impossible to use that approach. In the end, all the solutions required the users to enter a Personal Authentication Number (PIN) to uniquely identify them. Individual Solution Why not create a report for each user? Store the image in the report for that user, and give them their own copy of the report, saved on a local drive. This would work well for sites with a couple of users. But the report was complex, we found there were several others that also needed the secure dynamic image, and there were enough users to make this impractical. Multiple Images in one report So we could take one report, save all the signatures into a section each, and use the PIN number to select which section to display. This would be manageable, but the multiple images created a single security point of failure. If someone could break in, all the signatures would be available to them. Database Approach We did consider storing the images in a database table. Everywhere we looked with this opened up major security issues. Any other database retrieval tool such as MS-Access or even Excel could extract the data and images from the table. By putting the images in a table, the security moved outside the Crystal Reports framework. Developer Solutions Several developer solutions presented themselves. A custom viewer, encrypted RPT files, or encryption support inside our cViewIMAGE driver all seemed too difficult and expensive. File System Approach Dynamic Images are supported in Crystal Reports XI, and our cViewIMAGE COM driver (if you are running and older version of Crystal Reports. Both of these let you change the image location at run time. The solution we selected was to store site specific images in a local secure folder. The PIN would then calculate the folder and file name to extract.
Where to store?Crystal Reports XI includes the ability to have a dynamic image location. This is useful because it means you do not need to store your images in your database in order to display them in your report. (If you are on an older Crystal version, you can still have that functionality by using our cViewIMAGE utility to display a dynamic image on the page. It is available for Crystal Reports 8.5 or later). You place an image on the report and then use a formula to replace that image with another. So it is important to decide what data you store in your database to identify the image location. One approach is to give the field a fully qualified drive and path name to the image. If you do this you need to make sure that everyone who views the report has the same drive, path and image file available to them. A network or web folder might help here, but you need to make sure the images are always available to the report.
When you design a report with dynamic images, make sure folder names and permissions are not limiting your viewing options. |
|
|