cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dansshin
Advocate IV
Advocate IV

Image name from database

I have added Employee.jpg to my media content. In an image control, if I change the Image value of that control to Employee it shows me the picture of Employee.jpg. But if I bind that Image value to datasource field which passes in text "Employee" it's not working. Error I get is:

 

The property expects image values, but this rule produces incompatible Table values.

 

Anyone know how I can resolve this?

1 ACCEPTED SOLUTION

Accepted Solutions
Meneghino
Community Champion
Community Champion

Hi, yes, I just did a test and it looks as though in some upgrade the urls have been modified.

 

Try to create a text box and set its Text property to Employee, no quotation marks not single , not double.

 

This should show you the URL text.

 

Does it work?

 

View solution in original post

10 REPLIES 10
Meneghino
Community Champion
Community Champion

Hi @dansshin

 

Once you load Emplyee.jpg into media content, then Employee is an image url in PowerApps, the text value should be this:

 

ms-appx:///ctrllib/image/images/Employee.jpg

 

So the datasource field that you are trying to bind should pass the url text as text.

 

You can see if this works by setting the image control's Image property as follows:

 

 

"ms-appx:///ctrllib/image/images/Employee.jpg"

Please note the double quotes, this is now text.

 

Hi Meneghino,

 

First of all thank you for your time in responding to this. 

 

I tried changing the Image property to below and it doesn't seem to be working. ImagePath includes the jpg name with the extension and these jpg files are included in the media library within PowerApps. Even tried hard coding one of the jpg names directly and still didn't work.

 

Any other ideals?

 

If(ThisItem.ImagePath = "", 'Employee', "ms-appx:///ctrllib/image/images/" & ThisItem.ImagePath)
Meneghino
Community Champion
Community Champion

Hi, yes, I just did a test and it looks as though in some upgrade the urls have been modified.

 

Try to create a text box and set its Text property to Employee, no quotation marks not single , not double.

 

This should show you the URL text.

 

Does it work?

 

View solution in original post

@Meneghino Thanks for that tip. I did that for Employee and this is what I got. However based on this I'll probably take a different route since it looks like it's given a different name. I believe Employee is PNG file so extension is correct but not sure how it got to name of 0004 instead of Employee. 

 

ms-appdata:///local/Resources/Assets/Images/0004.png

Meneghino
Community Champion
Community Champion

OK, no problem, at least you know how to refer to locally stored images dynamically

@Meneghino Even with the correct string value in the Image property it doesn't seem to be pulling the image. Is there a function that could convert this string to Image?

Meneghino
Community Champion
Community Champion

@dansshin

That is strange, it is working fine for me.  Here is what I did:

0) Create a new blank app

1) Upload Duomo.jpg to PowerApps

2) Insert a text box and set Text = Duomo

3) Copy the resulting URL (including spaces etc)

4) Insert an image control and set Image = "ms-appdata:///local/Resources (22)/Assets/Images/0001.jpg"

Result below:

__.JPG

@Meneghino Thanks for taking the time to try that. I went in back into the app today and it was working with code I have save yesterday so perhaps it was cach issue.  

 

Thank you so much for your inputs! It's very much appreciated.

It seems to be working in design mode but when I run the app in iOS or even on Windows PowerApps app it doesn't show the images referenced as string path. Strange behavior.

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

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (21,841)