I have a report which is just one page per record. The record is chosen using a parameter.
On this report I have space for 4 images, I have a dataset called "AdditionalPhotos". I would like to put the image from the first four rows of this dataset into each of the spaces on the report.
To do this, I planned on using an expression with a function like : First(Image), Second(Image), Third(Image), Fourth(Image). I now realise that SSRS only supports First() and Last() so using some advice from another forum post : http://social.msdn.microsoft.com/Forums/sqlserver/en-US/20493945-578a-4d83-ae3b-e603a3473ac6/nth-row-element-in-a-dataset-ssrs
I have implemented another dataset which contains the same query as the "AdditionalPhotos" but with only 2 columns "ID" and "RowNum". Using this expression I can see a Photo Source field in a textbox, which is great, so the syntax is working.
=Lookup(1,Fields!Row.Value,Fields!Source.Value, "AdditionalPhotos")
In the value field for the image I have :
=Lookup(1,Fields!Row.Value,Fields!Image.Value, "AdditionalPhotos")
This doesn't work, I just get a red x icon in the image box of the report. I have the correct MIME type setting and have confirmed this by changing the expression for the image box to :
=Fields!Image.Value
Any advice or suggestions would be great.
In your SQL you can use the ROW_NUMBER()
window function to generate row numbers based on an order and/or a partition so that you can select which image you want where.
Something like:
SELECT Image,
ROW_NUMBER() OVER(ORDER BY id) AS rownum
FROM imageTable
See:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.