Author |
Topic |
harlingtonthewizard
Constraint Violating Yak Guru
352 Posts |
Posted - 2008-09-23 : 03:03:39
|
I have images stored on a hard drive and a field in the database of nvarchar datatype that contains the path to the image. How do I display the images on a report?Thanks |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-09-23 : 03:05:16
|
you mean harddrive on server? |
 |
|
harlingtonthewizard
Constraint Violating Yak Guru
352 Posts |
Posted - 2008-09-23 : 03:09:17
|
Yes, the images are all on the sql server PC in a directory structure. Just not in the database. |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-09-23 : 03:11:04
|
quote: Originally posted by harlingtonthewizard Yes, the images are all of the sql server PC. Just not in the database.
then give source property of image as external in report and give field containing path as the value of image. Also remember to retrive this field in report with a dataset. |
 |
|
harlingtonthewizard
Constraint Violating Yak Guru
352 Posts |
Posted - 2008-09-23 : 03:21:15
|
1. I have a dataset (Select ReportImage from ReportImage) that returns:c:\test.jpeg2. I have an image item on the layout.3. I have set the source to external and value to:=Fields!Reportimage.Value4. When i preview the reprot I get:Build complete -- 0 errors, 0 warnings[rsRuntimeErrorInExpression] The Value expression for the image ‘Sunset’ contains an error: The expression referenced a non-existing field in the fields collection.Preview complete -- 0 errors, 1 warnings |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-09-23 : 03:26:46
|
quote: Originally posted by harlingtonthewizard 1. I have a dataset (Select ReportImage from ReportImage) that returns:c:\test.jpeg2. I have an image item on the layout.3. I have set the source to external and value to:=Fields!Reportimage.Value4. When i preview the reprot I get:Build complete -- 0 errors, 0 warnings[rsRuntimeErrorInExpression] The Value expression for the image ‘Sunset’ contains an error: The expression referenced a non-existing field in the fields collection.Preview complete -- 0 errors, 1 warnings
where are you using the image. is the container linked to this dataset? |
 |
|
harlingtonthewizard
Constraint Violating Yak Guru
352 Posts |
Posted - 2008-09-23 : 03:37:58
|
Prevously I just had an image item dropped on the layout so it was not linked to a dataset. I just tried with a table item, then dropping an image item within a body row cell. This table has the Dataset name set to image (name of query above). Again source set to external and value as =FieldsReportimage.Value. I now get this error:Build complete -- 0 errors, 0 warnings[rsUnsupportedProtocol] The image ‘image1’ has the URL “c:\test.jpeg” as one of its properties. URLs in reports must begin with one of the following prefixes: http://, https://, ftp://, file:, mailto:, or news:.Preview complete -- 1 errors, 0 warnings |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-09-23 : 03:56:09
|
quote: Originally posted by harlingtonthewizard Prevously I just had an image item dropped on the layout so it was not linked to a dataset. I just tried with a table item, then dropping an image item within a body row cell. This table has the Dataset name set to image (name of query above). Again source set to external and value as =FieldsReportimage.Value. I now get this error:Build complete -- 0 errors, 0 warnings[rsUnsupportedProtocol] The image ‘image1’ has the URL “c:\test.jpeg” as one of its properties. URLs in reports must begin with one of the following prefixes: http://, https://, ftp://, file:, mailto:, or news:.Preview complete -- 1 errors, 0 warnings
instead of just using =FieldsReportimage.Value use like below and see=Globals!ReportServer & Right(FieldsReportimage.Value, Len(FieldsReportimage.Value) - InStr(FieldsReportimage.Value, "\")+1) |
 |
|
harlingtonthewizard
Constraint Violating Yak Guru
352 Posts |
Posted - 2008-09-23 : 04:14:29
|
When I try the above I get:The value expression for the image 'image1' contains an error: [BD30451] Name 'FieldsReportImage' is not declared.So I tried:=Globals!ReportServer & Right(Fields!Reportimage.Value, Len(Fields!Reportimage.Value) - InStr(Fields!Reportimage.Value, "\")+1)and obtained this error:[rsFieldReference] The Value expression for the image ‘image1’ refers to the field ‘Reportimage’. Report item expressions can only refer to fields within the current data set scope or, if inside an aggregate, the specified data set scope.I then changed Reportimage to ReportImage and received the following:Build complete -- 0 errors, 0 warnings[rsRuntimeErrorInExpression] The Value expression for the image ‘image1’ contains an error: Specified argument was out of the range of valid values.Preview complete -- 0 errors, 1 warningsThis part Globals!ReportServer appears in red underline in the expression editor. |
 |
|
harlingtonthewizard
Constraint Violating Yak Guru
352 Posts |
Posted - 2008-09-23 : 04:32:42
|
I found the problem:=Globals!ReportServerUrl & Right(Fields!ReportImage.Value, Len(Fields!ReportImage.Value) - InStr(Fields!ReportImage.Value, "\")+1)Thankyou |
 |
|
harlingtonthewizard
Constraint Violating Yak Guru
352 Posts |
Posted - 2008-09-23 : 20:40:23
|
Still not working. I have found the following: It was working with 3d-sunset1b.bmp because this file was in the project. As soon as I remove it then it also does not work. The report runs without errors however where the image should be a small box with a red cross in the centre appears. So the problem seems to be sql server does not know where to find the files, ie the path is incomplete. Wow, I would have thought just referencing a file on a hard drive would be easy:) |
 |
|
harlingtonthewizard
Constraint Violating Yak Guru
352 Posts |
Posted - 2008-09-23 : 21:43:34
|
I found this works with bmp images:="file:///" & Fields!ReportImage.Value |
 |
|
|