Question

I am building a SSRS report in BIDS for CRM 2011 on-premise. My report needs to show an image attached to the annotation ID of the record.

I have two images attached to one record and three records in total. What is happening is that when I run the report, the image is shown with the first record of the report only and that is not the record the image is attached too.

Here is my sql query for the report.

select Annotation.DocumentBody, 
        inmate_FirstName, inmate_LastName,inmate_MiddleName,inmate_BookingNumber, inmate_InmateNumber,inmate_DOB,inmate_Gender,
        inmate_BookingDate, inmate_Race

from new_bookingscreen1 left outer join
    Annotation on new_bookingscreen1.new_bookingscreen1Id = Annotation.ObjectId

What my guess is that when I add the image control in the report, it is just simply showing me the image and is not in anyway related to the report. As in there is no connection between the report query pasted above and the image control.

How do I solve this?

I am using this =First(Fields!DocumentBody.Value, "DataSet1") in the expression field of the image tool.

How do I bind the report query result to the image tool result?

Was it helpful?

Solution

You are using First() Function of SSRS which Returns the first value from the specified expression. Try this

=Fields!DocumentBody.Value

The only Bring forward the Imagies you actually need by doing something like ..

select Pic.Col1, inmate_FirstName, inmate_LastName,inmate_MiddleName
        ,inmate_BookingNumber, inmate_InmateNumber,inmate_DOB,inmate_Gender,inmate_BookingDate, inmate_Race


from new_bookingscreen1 OUTER APPLY (
                                    SELECT TOP 1 Annotation.DocumentBody
                                    FROM Annotation 
                                    WHERE ObjectId = new_bookingscreen1.new_bookingscreen1Id
                                    ORDER BY   -- Your Condition (How you decide which one is the 1st Picture)
                                    ) Pic(Col1)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top