SAP Knowledge Base Article - Public

1320507 - How to dynamically change an image, based on the parameter value selected for the report in Crystal Reports?

Symptom

  • How to change the picture dynamically?
  • How to display a different logon on the report based on the parameter value selected?
  • How to dynamically change the picture on a report based on the prompt value selected in Crystal Reports?

Environment

  • SAP Crystal Reports 2013
  • SAP Crystal Reports 2016
  • SAP Crystal Reports 2020

Resolution

  • To dynamically change an image on a report based on a parameter value selected, use the formatting option "Graphic Location"
             
    1. In Crystal Reports, open a report.
        
    2. Create a parameter, and set a List of Values that will correspond to the image to display on the report.
        
    3. Insert a static picture on the report, where you want the picture to display.
        
    4. Right click on the picture, and select "Format Graphic"
          
    5. In the "Format Editor" under the tab "Picture", click on the "X-2" button for the option: "Graphic"
       
        
         Graphic Location.png
            
           
    6. In the "Formula Editor", enter the path to the desired picture, based on the parameter value selected. The formula will look like:

        If {?Country Parameter} = "USA" Then 
                "C:\MyDocuments\MyPictures\USA.bmp"

        Else If {?Country Parameter} = "India" Then 
               "C:\MyDocuments\MyPictures\India.bmp"
             
    7. Click on Save and Close.
           
    8. Back to the "Format Editor", click "OK" to accept the change.


  • Notes:
    • When using dynamic Graphic Location, the image will dynamically change when viewing the report, but in the Design mode, it will always display the original image, because the design mode shows the structure of a report, and not dynamic content.
        
    • If the dynamic image provided in Graphic Location is not a valid path,or name, it will display the original image instead.

Keywords

dynamic , KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , Problem

Product

SAP Crystal Reports 2013 ; SAP Crystal Reports 2016 ; SAP Crystal Reports 2020