cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
davidstone
Kudo Kingpin
Kudo Kingpin

Weird bug with image resources

I'm trying to dynamically build a path to the resource for a particular Media object.

 

I worked out that I could concatenate "appres://resources/" along with some other letters which, strung together, point to one or another image. It's fairly rudimentary - it could be "EL_GR", and I'm just using a bunch of conditions to decide which letters to use.

 

When I put my formula into a label it correctly displays the full path to a valid resource, eg "appres://resources/EL_GR" - perfect.

 

Even better, I can put that formula into the 'Image' property of my media object - and it works! ...IN the desktop builder.

 

Once I publish, running on web or mobile, the media object no longer displays the actual image.

 

So to check it was still the same path on web and mobile, I placed a label and set its text value to simply 'EL_GR', directly referencing the media asset. On the app, it then displays the same resource path, as expected. So I published again, and all of a sudden the image now displays!

 

So in a sense I have a workaround - I can concat all my resources into a Label value and hide the label, and then everything is good.

 

But there's surely something wrong there for me to have to do this?

 

Thanks for any insight!

3 REPLIES 3
Meneghino
Community Champion
Community Champion

Hi @davidstone

I think the best way to resolve this is to load the images into a collection with a unique column to identify them.

Then you can dynamically look up the image.

Please let me know if you need details on this, but loading the collection is basically:

ClearCollect(MyImages,
  {Id:1, MyImage: ImageNameX},
  {Id:2, MyImage: ImageNameY},
 etc. etc.)

Thanks.

 

How would I then reference the image I wanted to display?

You should use the following as the Image property of an image control

 

LookUp(MyImages, Id=YourParameter, MyImage)

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Top Kudoed Authors
Users online (40,687)