Displaying a list of image urls

1 Answer 46 Views
Binding DataSources
J.T.
Top achievements
Rank 2
J.T. asked on 05 Jan 2024, 01:03 AM | edited on 08 Jan 2024, 04:05 PM

Hi Team,

I've dabbled with this a little bit, but I've got a parameter in a report that's set to take an array of images. I've inserted a list and set the datasource to the value of the parameter.


The value of this parameter will be something like:

[ "www.images.com/cat.jpg", "www.images.com/dog.jpg", "www.images.com/goldfish.jpg"]

How can I use this structure to assign these values to a Picture Box? I know ReportItem.DataObject exists, but I'm never quite sure how to use it, or if that's even the right approach. Guidance is much appreciated!

Thanks,
J.T.

1 Answer, 1 is accepted

Sort by
1
Accepted
Dimitar
Telerik team
answered on 09 Jan 2024, 12:20 PM

Hello J.T.,

Thank you for the provided information!

I assume that you have already done this but please make sure that the attachments report parameter is MultiValueMultivalue Parameters Explained - Telerik Reporting.

Then, as you have already done, you need to bind the DataSource property of the data item, in this case, the list, to the value of the report parameter. You have already done this and I see no problems there.

The last step is to use the values in the array with the PictureBox item. You may set the Value property to the expression =Fields.Item. When the data source is an array of primitive values, such as an array of strings, the field to access them is named Item.

I have attached a sample report to demonstrate this approach. Please have a look at it and let me know if you need further assistance.

Regards,
Dimitar
Progress Telerik

Stay tuned by visiting our roadmap and feedback portal pages, enjoy a smooth take-off with our Getting Started resources, or visit the free self-paced technical training at https://learn.telerik.com/.
J.T.
Top achievements
Rank 2
commented on 09 Jan 2024, 10:07 PM

Hi Dimitar,

I'm on an older version (R1 2022) of the report designer, so I was unable to see your example, but I was able to get things working by setting the PictureBox to =Fields.Item like you suggested, and changing the parameter value to:

= Array("www.images.com/cat.jpg", "www.images.com/dog.jpg", "www.images.com/goldfish.jpg")

For some reason, it didn't like when I declared the array directly and said the square brackets were illegal characters. With these changes, I was able to get it working! Thanks so much for your assistance!

-J.T.
Tags
Binding DataSources
Asked by
J.T.
Top achievements
Rank 2
Answers by
Dimitar
Telerik team
Share this question
or