1

I need to insert a report homepage on an existing RPT file. The existing RPT file works fine, it displays results from a stored procedure. It's ok.

The homepage must contain an image from the database. So first, I added a new SQL command (through the window "Database Expert") with a new SQL query in order to get the image logo. I drag & drop the image field in the Report Header section. It works in the designer, I can see the image which is retrieved from the database.

But when I generate the report, my SQL query which get the image is executed several times... I can see it in my SQL profiler... I think that my query is executed FOR EACH row which is returned by the initial stored procedure... I don't know why.

Version of Crystal Reports : 10.2

Any ideas ? Thanks a lot.

Nico
  • 575
  • 3
  • 8
  • 19
  • What do you mean by Report Section Header? You either have a Report Header, Page Header, or Group Header. – campagnolo_1 Oct 16 '13 at 12:55
  • Yes, I was talking about the Report Header. I finally found a solution, I put a SubReport in the Report Header and I requested the image in this SubReport. – Nico Oct 16 '13 at 13:03
  • I'm not sure why you are doing it that way, sounds like a lot of work. See my answer below. Is there a reason you need to get the image using a query? If you add it as a file to the report it will automatically be added and stay with the report. – campagnolo_1 Oct 16 '13 at 13:06
  • Yes it's complicated, it's true, but I can't access to this file with a classic file path. It's stored in a distant SQL database, that's why I need to use an SQL query in a SubReport in order to download the image only one time. Thanks ! – Nico Oct 16 '13 at 13:23
  • Fair enough. If that works for you is all that matters! ;) – campagnolo_1 Oct 16 '13 at 13:36

2 Answers2

2

If you just need to add a single image that is not bound to any data (i.e. image of product you are listing in your report), you can easily add a picture from the file system by following these simple steps:

1) Click "Insert" from the file menu

2) Select Picture

3) Browse to the picture file

4) Select the file and then click the place in the report where you want to put the image

5) After inserting the picture you can click on it and move/resize

campagnolo_1
  • 2,710
  • 1
  • 17
  • 25
1

I finally found the following solution :

1 > Create a new SubReport. (Right click on the designer > Insert > SubReport). This new SubReport will be related to the table which contain the image data.

2 > Ensure that this sub report is in the Report Header section. Remove black borders if needed.

3 > In the SubReport, drag your image SQL field into the Details section. Don't forget to specify an equals-condition in order to retrieve the right image.

Nico
  • 575
  • 3
  • 8
  • 19